public IHttpActionResult GetForm(int id) { string accessType = "BTSStatus_ViewAll"; if (id > 0) { ThrowIfUserHasNoRole(accessType); } using (BTSStatusEntryDataProvider btsStatusEntryDataProvider = new BTSStatusEntryDataProvider(Db, ActiveUser, AccessControl, new BTSStatusQuery(Db))) { var data = btsStatusEntryDataProvider.Get(id); SaveLog("BTSStatus", "GetForm", JsonConvert.SerializeObject(new { primaryKey = id })); return(Ok(new SuccessResponse(data))); } }
public SaveResult <BTSStatusEntryModel> Save(BTSStatusDTO btsStatusDTO, DateTime dateStamp) { ModelValidationResult validationResult = btsStatusValidator.Validate(btsStatusDTO); bool success = false; BTSStatusEntryModel model = null; if (validationResult.IsValid) { success = true; Update(btsStatusDTO, dateStamp); Db.SaveChanges(); model = btsStatusEntryDataProvider.Get(btsStatusDTO.BTSStatus_PK); } return(new SaveResult <BTSStatusEntryModel> { Success = success, Message = validationResult.IsValid ? "Data successfully updated." : "Validation error occured.", Model = model, ValidationResult = validationResult }); }