Exemplo n.º 1
0
 public ActionResult AddCategory(Category item)
 {
     if (cat_repo.Any(x => x.CategoryName == item.CategoryName))
     {
         ViewBag.Mevcut = "Kategori Zaten Mevcut";
     }
     else
     {
         item.CreatedBy = (Session["admin"] as AppUser).UserName;
         cat_repo.Add(item);
         return(RedirectToAction("ListCategory"));
     }
     return(View());
 }
        public ActionResult AddCategory(Category item)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }

            if (item != null)
            {
                if (crep.Any(x => x.CategoryName == item.CategoryName && x.Description == item.Description && x.Status != MODEL.Enums.DataStatus.Deleted))
                {
                    ViewBag.Mevcut = "Eklenmek istenen kategori zaten mevcut.";
                    return(View());
                }
                crep.Add(item);
                return(RedirectToAction("ListCategory"));
            }
            ViewBag.Hata = "Hata Oluştu.";
            return(View());
        }