public ActionResult Edit([Bind(Include = "CountryID,CountryName,Remarks,Created,Modified,UserID")] LOC_Country lOC_Country) { if (lOC_Country.CountryID > 0) { if (lOC_Country.Remarks == null || lOC_Country.Remarks == "") { ViewBag.UserID = new SelectList(db.SEC_User, "UserID", "UserName", lOC_Country.UserID); ModelState.AddModelError("", "Enter Remarks"); return(View(lOC_Country)); } } if (ModelState.IsValid) { db.Entry(lOC_Country).State = EntityState.Modified; lOC_Country.Modified = DateTime.Now; lOC_Country.Created = DateTime.Now; if (Session["UserID"] != null) { lOC_Country.UserID = Convert.ToInt16(Session["UserID"].ToString()); } db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.UserID = new SelectList(db.SEC_User, "UserID", "UserName", lOC_Country.UserID); return(View(lOC_Country)); }
// GET: LOC_Country/Create public ActionResult Create() { ViewBag.UserID = new SelectList(db.SEC_User, "UserID", "UserName"); LOC_Country lOC_Country = new LOC_Country(); return(View("Edit", lOC_Country)); }
public ActionResult DeleteConfirmed(int id) { LOC_Country lOC_Country = db.LOC_Country.Find(id); db.LOC_Country.Remove(lOC_Country); db.SaveChanges(); return(RedirectToAction("Index")); }
// GET: LOC_Country/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } LOC_Country lOC_Country = db.LOC_Country.Find(id); if (lOC_Country == null) { return(HttpNotFound()); } return(View(lOC_Country)); }
// GET: LOC_Country/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } LOC_Country lOC_Country = db.LOC_Country.Find(id); if (lOC_Country == null) { return(HttpNotFound()); } ViewBag.UserID = new SelectList(db.SEC_User, "UserID", "UserName", lOC_Country.UserID); return(View(lOC_Country)); }
public ActionResult Create([Bind(Include = "CountryID,CountryName,Remarks,Created,Modified,UserID")] LOC_Country lOC_Country) { lOC_Country.Created = DateTime.Now; lOC_Country.Modified = DateTime.Now; if (Session["UserID"] != null) { lOC_Country.UserID = Convert.ToInt16(Session["UserID"].ToString()); } if (ModelState.IsValid) { db.LOC_Country.Add(lOC_Country); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.UserID = new SelectList(db.SEC_User, "UserID", "UserName", lOC_Country.UserID); return(View()); }