public IHttpActionResult GetForm(int id) { string accessType = "AuthParam_ViewAll"; ThrowIfUserCannotAccess(accessType); using (AuthParamEntryDataProvider authParamEntryDataProvider = new AuthParamEntryDataProvider(Db, ActiveUser, AccessControl, new AuthParamQuery(Db))) { var data = authParamEntryDataProvider.Get(id); SaveLog("AuthParam", "GetForm", JsonConvert.SerializeObject(new { primaryKey = id })); return(Ok(new SuccessResponse(data))); } }
public IHttpActionResult GetForm(int id) { if (id > 0) { ThrowIfUserHasNoRole(readRole); } using (AuthParamEntryDataProvider authParamEntryDataProvider = new AuthParamEntryDataProvider(Db, ActiveUser, AccessControl, new AuthParamQuery(Db))) { var data = authParamEntryDataProvider.Get(id); SaveLog("AuthParam", "GetForm", JsonConvert.SerializeObject(new { primaryKey = id })); return(Ok(new SuccessResponse(data))); } }
public SaveResult <AuthParamEntryModel> Save(AuthParamDTO authParamDTO, DateTime dateStamp) { ModelValidationResult validationResult = authParamValidator.Validate(authParamDTO); bool success = false; AuthParamEntryModel model = null; if (validationResult.IsValid) { success = true; Update(authParamDTO, dateStamp); Db.SaveChanges(); model = authParamEntryDataProvider.Get(authParamDTO.AuthParam_PK); } return(new SaveResult <AuthParamEntryModel> { Success = success, Message = validationResult.IsValid ? "Data successfully updated." : "Validation error occured.", Model = model, ValidationResult = validationResult }); }