public long Create(OperationalIncident entity) { CommonHelper.ValidateArgumentNotNull(entity, nameof(entity)); Helper.ValidateTodayIsAllowedUpdateDate(entity.IncidentYear, entity.IncidentMonth, InputAllowedInDays); // populate audit fields PopulateAuditFields(entity, null, creating: true); return(OperationalIncidentService.Create(entity).Id); }
public OperationalIncident Update(long id, OperationalIncident entity) { CommonHelper.ValidateArgumentNotNull(entity, nameof(entity)); Helper.ValidateTodayIsAllowedUpdateDate(entity.IncidentYear, entity.IncidentMonth, InputAllowedInDays); var existing = OperationalIncidentService.Get(id); if (!IsAdmin()) { Helper.ValidateStatusIsDraft(existing.Status); } // populate audit fields PopulateAuditFields(entity, existing); entity.Id = id; return(OperationalIncidentService.Update(entity)); }
public int GetLastTalliedNumber(int year, int month) { return(OperationalIncidentService.GetLastTalliedNumber(year, month)); }
public SearchResult <OperationalIncident> Search([FromUri] OperationalIncidentSearchCriteria criteria) { criteria = criteria ?? new OperationalIncidentSearchCriteria(); return(OperationalIncidentService.Search(criteria)); }
public OperationalIncident Get(long id) { return(OperationalIncidentService.Get(id)); }