예제 #1
0
        public async Task <IActionResult> Edit(string id, [Bind("ProdId,ProdType")] ProdMst prodMst)
        {
            if (id != prodMst.ProdId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(prodMst);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProdMstExists(prodMst.ProdId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(prodMst));
        }
예제 #2
0
        public ActionResult DeleteConfirmed(string id)
        {
            ProdMst prodMst = db.ProdMsts.Find(id);

            db.ProdMsts.Remove(prodMst);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #3
0
 public ActionResult Edit(ProdMst prod)
 {
     if (ModelState.IsValid)
     {
         db.Edit(prod);
         return(RedirectToAction("Index"));
     }
     return(View());
 }
예제 #4
0
 public ActionResult Edit([Bind(Include = "ProdId,ProdType,ProdThumbnail")] ProdMst prodMst)
 {
     if (ModelState.IsValid)
     {
         db.Entry(prodMst).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(prodMst));
 }
예제 #5
0
        public async Task <IActionResult> Create([Bind("ProdId,ProdType")] ProdMst prodMst)
        {
            if (ModelState.IsValid)
            {
                _context.Add(prodMst);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(prodMst));
        }
예제 #6
0
        public ActionResult Create([Bind(Include = "ProdId,ProdType,ProdThumbnail")] ProdMst prodMst)
        {
            prodMst.ProdId = "pro" + Guid.NewGuid().ToString().GetHashCode().ToString("x");
            if (ModelState.IsValid)
            {
                db.ProdMsts.Add(prodMst);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(prodMst));
        }
예제 #7
0
        // GET: Admin/ProdMsts/Delete/5
        public ActionResult Delete(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ProdMst prodMst = db.ProdMsts.Find(id);

            if (prodMst == null)
            {
                return(HttpNotFound());
            }
            return(View(prodMst));
        }