public IHttpActionResult Get(int id) { ThrowIfUserHasNoRole(readRole); using (AreaQuery areaQuery = new AreaQuery(Db)) { var data = areaQuery.GetByPrimaryKey(id); SaveLog("Area", "Get", JsonConvert.SerializeObject(new { primaryKey = id })); return(Ok(new SuccessResponse(data))); } }
private AreaEntryModel GetUpdateStateModel(int areaPK) { AreaEntryFormData formData = new AreaEntryFormData(); List <Control> formControls = CreateFormControls(areaPK); AreaDTO areaDTO = areaQuery.GetByPrimaryKey(areaPK); if (areaDTO == null) { throw new KairosException($"Record with primary key '{areaDTO.Area_PK}' is not found."); } return(new AreaEntryModel() { FormData = formData, FormControls = formControls, Model = areaDTO, }); }