public IHttpActionResult UpdateModel(int id, TMS_Models tmsModels) { if (tmsModels == null) { return(Ok(new { Msg = "0" })); } if (id != tmsModels.Id) { //return BadRequest(); return(Ok(new { Msg = "0" })); } try { int s = _objTmsModelsBll.Update(tmsModels); if (s == 1) { return(Ok(new { Msg = "1" })); } return(Ok(new { Msg = "0" })); } catch (DbUpdateConcurrencyException) { if (!CrmContactExists(id)) { //return NotFound(); return(Ok(new { Msg = "0", Reason = "No row affected!" })); } else { throw; } } }
public IHttpActionResult Post(TMS_Models tmsModels) { if (tmsModels == null) { return(Ok(new { Msg = "0" })); } try { int s = _objTmsModelsBll.Insert(tmsModels); if (s == 1) { return(Ok(new { Msg = "1" })); } return(Ok(new { Msg = "0" })); } catch (DbUpdateConcurrencyException) { return(Ok(new { Msg = "0", Reason = "No row affected!" })); } }
public int Insert(TMS_Models tmsModels) { return(_repository.Insert(tmsModels)); }
public int Update(TMS_Models tmsModels) { return(_repository.Update(tmsModels)); }