refactoring messages

This commit is contained in:
Paul Schneider 2018-02-03 20:17:29 +01:00
commit 13bdf7463d
44 changed files with 602 additions and 303 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) {