public IActionResult Edit(Income income) { if (ModelState.IsValid) { _incomeRepository.EditIncome(income); } return(RedirectToAction(nameof(Index))); }
public JsonResult EditIncome([System.Web.Http.FromBody] tblIncomeSource income) { if (Session["role"] == null) { Session["userId"] = null; Session["role"] = null; return(Json(false, JsonRequestBehavior.AllowGet)); } else if (Session["role"].ToString() == "Super Admin") { income.date = DateTime.ParseExact(income.date.ToString("dd-MM-yyyy"), "dd-MM-yyyy", CultureInfo.InvariantCulture); return(Json(incomeRepository.EditIncome(income), JsonRequestBehavior.AllowGet)); } else { Session["userId"] = null; Session["role"] = null; return(Json(false, JsonRequestBehavior.AllowGet)); } }