public async Task <IActionResult> Create(AuditPicMDto auditPicM) { var username = User.FindFirst(ClaimTypes.NameIdentifier).Value; auditPicM.Updated_By = username; if (await _service.Add(auditPicM)) { return(CreatedAtRoute("GetAuditPicMs", new {})); } throw new Exception("Creating the Audit PicM failed on save"); }
public async Task <IActionResult> Create(AuditPicMDto auditPicM) { if (await _service.CheckAuditPicMExists(auditPicM.PIC_Type_ID)) { return(BadRequest("PIC Type ID already exits!")); } var username = User.FindFirst(ClaimTypes.Name).Value; auditPicM.Updated_By = username; if (await _service.Add(auditPicM)) { return(CreatedAtRoute("GetAuditPicMs", new {})); } throw new Exception("Creating the Audit PicM failed on save"); }