Exemple #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            LocationStock locationstock = db.LocationStocks.Find(id);

            db.LocationStocks.Remove(locationstock);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #2
0
 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));
 }
Exemple #3
0
        // 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));
        }
Exemple #4
0
        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));
        }
Exemple #5
0
        // 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));
        }
Exemple #6
0
        // 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));
        }