estimate to client

This commit is contained in:
Paul Schneider 2016-12-11 14:45:51 +01:00
commit 3acb5bc922
13 changed files with 127 additions and 40 deletions

View file

@ -11,6 +11,7 @@ namespace Yavsc.Controllers
{
using System;
using Yavsc.Model;
using Yavsc.Models.Messaging;
using Yavsc.Models;
using Yavsc.Models.Booking;
@ -43,7 +44,10 @@ namespace Yavsc.Controllers
Include(c => c.Client).Where(c => c.PerformerId == uid && c.Id < maxId && c.EventDate > now).
Select(c => new BookQueryProviderInfo
{
Client = new ClientProviderInfo { UserName = c.Client.UserName, UserId = c.ClientId },
Client = new ClientProviderInfo {
UserName = c.Client.UserName,
UserId = c.ClientId,
Avatar = c.Client.Avatar },
Location = c.Location,
EventDate = c.EventDate,
Id = c.Id,

View file

@ -1,10 +1,9 @@
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNet.Http;
using Microsoft.AspNet.Mvc;
using Microsoft.Data.Entity;
using Yavsc.Model;
using Yavsc.Models;
using Yavsc.Models.Messaging;
namespace Yavsc.Controllers
{
@ -20,29 +19,10 @@ namespace Yavsc.Controllers
}
// GET: api/ContactsApi
[HttpGet]
public IEnumerable<ClientProviderInfo> GetClientProviderInfo()
[HttpGet("{id}")]
public ClientProviderInfo GetClientProviderInfo(string id)
{
return _context.ClientProviderInfo;
}
// GET: api/ContactsApi/5
[HttpGet("{id}", Name = "GetClientProviderInfo")]
public IActionResult GetClientProviderInfo([FromRoute] string id)
{
if (!ModelState.IsValid)
{
return HttpBadRequest(ModelState);
}
ClientProviderInfo clientProviderInfo = _context.ClientProviderInfo.Single(m => m.UserId == id);
if (clientProviderInfo == null)
{
return HttpNotFound();
}
return Ok(clientProviderInfo);
return _context.ClientProviderInfo.FirstOrDefault(c=>c.UserId == id);
}
// PUT: api/ContactsApi/5