refactoring messages

This commit is contained in:
2018-02-03 20:17:29 +01:00
parent edd91faa96
commit 6c18f32f61
44 changed files with 603 additions and 304 deletions

View File

@ -114,14 +114,16 @@ namespace Yavsc.Controllers
public IActionResult PostEstimate([FromBody] Estimate estimate)
{
var uid = User.GetUserId();
if (!User.IsInRole(Constants.AdminGroupName))
{
if (estimate.OwnerId==null) estimate.OwnerId = uid;
if (!User.IsInRole(Constants.AdminGroupName)) {
if (uid != estimate.OwnerId)
{
ModelState.AddModelError("OwnerId","You can only create your own estimates");
return HttpBadRequest(ModelState);
}
}
if (estimate.CommandId!=null) {
var query = _context.RdvQueries.FirstOrDefault(q => q.Id == estimate.CommandId);
if (query == null) {