public ActionResult Create(E_Payment_Config payment_config) { if (ModelState.IsValid) { db.E_Payment_Config.Add(payment_config); db.SaveChanges(); return RedirectToAction("Index"); } return View(payment_config); }
public ActionResult Edit(E_Payment_Config payment_config) { if (Session["login_status"] != null) { int[] z = (int[])Session["function_id"]; if (z.Contains(25)) { if (ModelState.IsValid) { if (payment_config.sos + payment_config.usd != 100) { TempData["errorMessage"] = "Failed To Update"; return RedirectToAction("Index"); } else { var payment_config_id = Convert.ToInt32(TempData["payment_config_id"]); E_Payment_Config payment_config_new = db.E_Payment_Config.Find(payment_config_id); payment_config_new.end_date = DateTime.Now; db.Entry(payment_config_new).State = EntityState.Modified; db.SaveChanges(); payment_config.created_date = DateTime.Now; payment_config.end_date = Convert.ToDateTime("9999-12-31"); db.E_Payment_Config.Add(payment_config); db.SaveChanges(); TempData["errorMessage"] = "Edited Successfully"; return RedirectToAction("Index"); } } return RedirectToAction("Index"); } else { return RedirectToAction("../Home/Dashboard"); } } else { return RedirectToAction("../Home"); } }