public IHttpActionResult GetForm(int id) { string accessType = "SOWIssue_ViewAll"; if (id > 0) { ThrowIfUserHasNoRole(accessType); } using (SOWIssueEntryDataProvider sowIssueEntryDataProvider = new SOWIssueEntryDataProvider(Db, ActiveUser, AccessControl, new SOWIssueQuery(Db))) { var data = sowIssueEntryDataProvider.Get(id); SaveLog("SOWIssue", "GetForm", JsonConvert.SerializeObject(new { primaryKey = id })); return(Ok(new SuccessResponse(data))); } }
public SaveResult <SOWIssueEntryModel> Save(SOWIssueDTO sowIssueDTO, DateTime dateStamp) { ModelValidationResult validationResult = sowIssueValidator.Validate(sowIssueDTO); bool success = false; SOWIssueEntryModel model = null; if (validationResult.IsValid) { success = true; Update(sowIssueDTO, dateStamp); Db.SaveChanges(); model = sowIssueEntryDataProvider.Get(sowIssueDTO.SOWIssue_PK); } return(new SaveResult <SOWIssueEntryModel> { Success = success, Message = validationResult.IsValid ? "Data successfully updated." : "Validation error occured.", Model = model, ValidationResult = validationResult }); }