public IHttpActionResult Post(TMS_WorkVerification workVerification) { if (workVerification.WorkVerificationName == String.Empty) { return(Json(new { Msg = "0", Reason = "Verification Name field cannot be empty!" })); } if (workVerification.CurrentStage == String.Empty) { return(Json(new { Msg = "0", Reason = "Current Stage field cannot be empty!" })); } if (workVerification.Notes == String.Empty) { return(Json(new { Msg = "0", Reason = "Note field cannot be empty!" })); } if (ModelState.IsValid) { int c = _workVerificationBll.Insert(workVerification); if (c == 1) { return(Json(new { Msg = "1" })); } return(Json(new { Msg = "0" })); } else { return(Json(new { Msg = "0" })); } }
public IHttpActionResult UpdateWorkVerification(int id, TMS_WorkVerification workVerification) { if (workVerification.WorkVerificationName == String.Empty) { return(Json(new { Msg = "0", Reason = "Verification Name field cannot be empty!" })); } if (workVerification.CurrentStage == String.Empty) { return(Json(new { Msg = "0", Reason = "Current Stage field cannot be empty!" })); } if (workVerification.Notes == String.Empty) { return(Json(new { Msg = "0", Reason = "Note field cannot be empty!" })); } if (!ModelState.IsValid) { return(Json(new { Msg = "0" })); } if (id != workVerification.Id) { //return BadRequest(); return(Json(new { Msg = "0" })); } try { int s = _workVerificationBll.Update(workVerification); if (s == 1) { return(Json(new { Msg = "1" })); } return(Json(new { Msg = "0" })); } catch (DbUpdateConcurrencyException) { if (!DeleteWorkVerificationExists(id)) { //return NotFound(); return(Json(new { Msg = "0", Reason = "Exception!" })); } else { throw; } } }
public int Update(TMS_WorkVerification workVerification) { return(_repository.Update(workVerification)); }
public int Insert(TMS_WorkVerification workVerification) { return(_repository.Insert(workVerification)); }