public ActionResult Edit(PayrollPeriodViewModel model) { if (ModelState.IsValid) { Responses responses = PayrollPeriodRepo.Update(model); if (responses.Success) { return(Json(new { success = true }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { success = false, message = responses.Message }, JsonRequestBehavior.AllowGet)); } } return(Json(new { success = false, message = ModelState.ToString() }, JsonRequestBehavior.AllowGet)); }
public ActionResult Create(PayrollPeriodViewModel model) { if (ModelState.IsValid) { Responses responses = PayrollPeriodRepo.Update(model); if (responses.Success) { return(Json(new { success = true }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { success = false, message = "Error msg" }, JsonRequestBehavior.AllowGet)); } } return(Json(new { success = false, message = "Invalid" }, JsonRequestBehavior.AllowGet)); }
// PUT api/<controller>/5 public Responses Put(int id, [FromBody] PayrollPeriodViewModel entity) { entity.Id = id; return(PayrollPeriodRepo.Update(entity)); }
// POST api/<controller> public Responses Post([FromBody] PayrollPeriodViewModel entity) { return(PayrollPeriodRepo.Update(entity)); }