public IHttpActionResult GetForm(int id) { //string accessType = "SOWTrackResult_ViewAll"; //if (id > 0) // ThrowIfUserHasNoRole(accessType); using (SOWTrackResultEntryDataProvider sowTrackResultEntryDataProvider = new SOWTrackResultEntryDataProvider(Db, ActiveUser, AccessControl, new SOWTrackResultQuery(Db))) { var data = sowTrackResultEntryDataProvider.Get(id); SaveLog("SOWTrackResult", "GetForm", JsonConvert.SerializeObject(new { primaryKey = id })); return(Ok(new SuccessResponse(data))); } }
public SaveResult <SOWTrackResultEntryModel> Save(SOWTrackResultDTO sowTrackResultDTO, DateTime dateStamp) { ModelValidationResult validationResult = sowTrackResultValidator.Validate(sowTrackResultDTO); bool success = false; SOWTrackResultEntryModel model = null; if (validationResult.IsValid) { success = true; Update(sowTrackResultDTO, dateStamp); Db.SaveChanges(); model = sowTrackResultEntryDataProvider.Get(sowTrackResultDTO.SOWTrackResult_PK); } return(new SaveResult <SOWTrackResultEntryModel> { Success = success, Message = validationResult.IsValid ? "Data successfully updated." : "Validation error occured.", Model = model, ValidationResult = validationResult }); }