public ActionResult DeleteConfirmed(int id) { LocationStock locationstock = db.LocationStocks.Find(id); db.LocationStocks.Remove(locationstock); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "LocationID,LocationName,CreateBy,UpdateBy,DateCreate,DateUpdate")] LocationStock locationstock) { if (ModelState.IsValid) { db.Entry(locationstock).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(locationstock)); }
// GET: /LocationStock/Create public ActionResult Create() { LocationStock locationstock = new LocationStock(); locationstock.CreateBy = System.Web.HttpContext.Current.User.Identity.Name; locationstock.UpdateBy = System.Web.HttpContext.Current.User.Identity.Name; locationstock.DateCreate = DateTime.Now; locationstock.DateUpdate = DateTime.Now; return(View(locationstock)); }
public ActionResult Create([Bind(Include = "LocationID,LocationName,CreateBy,UpdateBy,DateCreate,DateUpdate")] LocationStock locationstock) { if (ModelState.IsValid && !db.LocationStocks.Any(d => d.LocationName == locationstock.LocationName)) { db.LocationStocks.Add(locationstock); db.SaveChanges(); return(RedirectToAction("Index")); } ModelState.AddModelError("LocationName", "LocationName is Duplicate"); return(View(locationstock)); }
// GET: /LocationStock/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } LocationStock locationstock = db.LocationStocks.Find(id); if (locationstock == null) { return(HttpNotFound()); } return(View(locationstock)); }
// GET: /LocationStock/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } LocationStock locationstock = db.LocationStocks.Find(id); locationstock.CreateBy = System.Web.HttpContext.Current.User.Identity.Name; locationstock.UpdateBy = System.Web.HttpContext.Current.User.Identity.Name; locationstock.DateCreate = DateTime.Now; locationstock.DateUpdate = DateTime.Now; if (locationstock == null) { return(HttpNotFound()); } return(View(locationstock)); }