public ActionResult Edit(EmployeeSalaryViewModel model) { if (ModelState.IsValid) { Responses responses = EmployeeSalaryRepo.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)); }
public ActionResult Create(EmployeeSalaryViewModel model) { if (ModelState.IsValid) { Responses responses = EmployeeSalaryRepo.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)); }
// PUT api/<controller>/5 public Responses Put(int id, [FromBody] EmployeeSalaryViewModel entity) { entity.Id = id; return(EmployeeSalaryRepo.Update(entity)); }
// POST api/<controller> public Responses Post([FromBody] EmployeeSalaryViewModel entity) { return(EmployeeSalaryRepo.Update(entity)); }