public ActionResult Update(SETUP_Country country) { Country dpCountry = new Country(); bool updated = dpCountry.Update(country); if (updated) { return(RedirectToAction("ViewDetail", "Country", new { id = country.Cont_Id })); } else { TempData["error"] = "Opps! Somthing went wrong!"; return(RedirectToAction("Edit", "Country", new { id = country.Cont_Id })); } }
public ActionResult Add(SETUP_Country country) { Country dpCountry = new Country(); int id = dpCountry.Add(country); if (id > 0) { return(RedirectToAction("Index", "Country")); } else { TempData["error"] = "Opps! Somthing went wrong!"; return(RedirectToAction("Add", "Country")); } }
/// <summary> /// Updates modified values of country to the database.... /// </summary> /// <param name="department"></param> /// <returns>Returns true if updated successfully else returns false.</returns> public bool Update(SETUP_Country country) { using (eSuiteEntities db = new eSuiteEntities()) { try { db.Entry(country).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(true); } catch { return(false); } } }
/// <summary> /// Adds new country to the database.... /// </summary> /// <param name="department"></param> /// <returns>Returns new country id if saved successfully else returns 0</returns> public int Add(SETUP_Country country) { using (eSuiteEntities db = new eSuiteEntities()) { try { db.Entry(country).State = System.Data.Entity.EntityState.Added; db.SaveChanges(); return(country.Cont_Id); } catch { return(0); } } }