Ejemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            ProdCatType prodCatType = db.ProdCatType.Find(id);

            db.ProdCatType.Remove(prodCatType);
            db.SaveChanges();
            Success("Deleted successfully", true);
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
        // GET: ProdCatType/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ProdCatType prodCatType = db.ProdCatType.Find(id);

            if (prodCatType == null)
            {
                return(HttpNotFound());
            }
            return(View(prodCatType));
        }
Ejemplo n.º 3
0
        // GET: ProdCatType/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ProdCatType prodCatType = db.ProdCatType.Find(id);

            if (prodCatType == null)
            {
                return(HttpNotFound());
            }
            ViewBag.BuyerInfoId    = new SelectList(db.BuyerInfo.OrderBy(x => x.Name), "Id", "Name", prodCatType.ProdCategory.BuyerInfoId);
            ViewBag.ProdCategoryId = new SelectList(db.ProdCategory.Where(x => x.BuyerInfoId == prodCatType.ProdCategory.BuyerInfoId), "Id", "Name", prodCatType.ProdCategoryId);
            return(View(prodCatType));
        }
Ejemplo n.º 4
0
 public ActionResult Edit([Bind(Include = "Id,ProdCategoryId,Name,Description")] ProdCatType prodCatType, int?BuyerInfoId)
 {
     if (ModelState.IsValid)
     {
         if (db.ProdCatType.Where(x => x.ProdCategoryId == prodCatType.ProdCategoryId && x.Name == prodCatType.Name && x.Id != prodCatType.Id).Count() > 0)
         {
             Danger("Name exists! Try different", true);
         }
         else
         {
             db.Entry(prodCatType).State = EntityState.Modified;
             db.SaveChanges();
             Success("Saved successfully!", true);
             return(RedirectToAction("Index"));
         }
     }
     ViewBag.BuyerInfoId    = new SelectList(db.BuyerInfo.OrderBy(x => x.Name), "Id", "Name", BuyerInfoId);
     ViewBag.ProdCategoryId = new SelectList(db.ProdCategory.OrderBy(x => x.Name), "Id", "Name", prodCatType.ProdCategoryId);
     return(View(prodCatType));
 }