a fix?
This commit is contained in:
parent
ea5ab19f8f
commit
f5e3e86006
1 changed files with 7 additions and 2 deletions
|
|
@ -6,6 +6,7 @@ using Microsoft.AspNet.Http;
|
||||||
using Microsoft.AspNet.Mvc;
|
using Microsoft.AspNet.Mvc;
|
||||||
using Microsoft.Data.Entity;
|
using Microsoft.Data.Entity;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Billing;
|
using Yavsc.Models.Billing;
|
||||||
|
|
||||||
|
|
@ -123,13 +124,17 @@ namespace Yavsc.Controllers
|
||||||
}
|
}
|
||||||
if (estimate.CommandId!=null) {
|
if (estimate.CommandId!=null) {
|
||||||
var query = _context.RdvQueries.FirstOrDefault(q => q.Id == estimate.CommandId);
|
var query = _context.RdvQueries.FirstOrDefault(q => q.Id == estimate.CommandId);
|
||||||
if (query == null || query.PerformerId!= uid)
|
if (query == null) {
|
||||||
return HttpBadRequest(ModelState);
|
return HttpBadRequest(ModelState);
|
||||||
|
}
|
||||||
query.ValidationDate = DateTime.Now;
|
query.ValidationDate = DateTime.Now;
|
||||||
|
_context.SaveChanges(User.GetUserId());
|
||||||
|
_context.Entry(query).State = EntityState.Detached;
|
||||||
}
|
}
|
||||||
if (!ModelState.IsValid)
|
if (!ModelState.IsValid)
|
||||||
{
|
{
|
||||||
return new BadRequestObjectResult(ModelState);
|
_logger.LogError(JsonConvert.SerializeObject(ModelState));
|
||||||
|
return Json(ModelState);
|
||||||
}
|
}
|
||||||
_context.Estimates.Add(estimate);
|
_context.Estimates.Add(estimate);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue