public bool CreateTestSetting(TestSettingModel model) { var entity = MappingUtil.Map <TestSettingModel, TestSetting>(model); _uow.TestSettings.Add(entity); _uow.SaveChanges(); MappingUtil.Map(entity, model); return(true); }
public TestSettingModel GetTestSetting(int id) { TestSettingModel model = null; var entity = _uow.TestSettings.GetById(id); if (entity != null) { model = MappingUtil.Map <TestSetting, TestSettingModel>(entity); } return(model); }
public bool UpdateTestSetting(TestSettingModel model) { var entity = MappingUtil.Map <TestSettingModel, TestSetting>(model); try { _uow.TestSettings.Update(entity); _uow.SaveChanges(); } catch (Exception ex) { _loggingSvc.Log(ex); return(false); } return(true); }
public HttpResponseMessage Patch([FromBody] TestSettingModel model) { try { if (ModelState.IsValid == false || _testSettingSvc.UpdateTestSetting(model) == false) { return(Request.CreateResponse(HttpStatusCode.BadRequest, ModelState)); } return(Request.CreateResponse(HttpStatusCode.OK, model)); } catch (ServiceException ex) { return(Request.CreateResponse(ex.HttpStatusCode, ex.Message)); } }