Beispiel #1
0
        public ActionResult Add(Make model, List <Guid> CategoryID)
        {
            Make make = new Make();

            make.MakeID   = Guid.NewGuid();
            make.MakeName = model.MakeName;
            make.IsActive = true;
            foreach (var item in CategoryID)
            {
                Guid     id  = Guid.Parse(item.ToString());
                Category cat = CategoryDAL.Get(x => x.CategoryID == id && x.IsActive == true);
                if (CategoryDAL.Get(x => x.SubCategoryID == cat.CategoryID) == null)
                {
                    make.Categories.Add(cat);
                }
            }

            if (MakeDAL.Get(x => x.MakeName == make.MakeName) != null || !ModelState.IsValid)
            {
                VMMakeAdd vmMake      = new VMMakeAdd();
                Guid      teknolojiID = Guid.Parse("35391ff3-c30d-4a6a-b30b-14079eaaa455");
                vmMake.Categories = CategoryDAL.GetList(x => x.SubCategoryID == teknolojiID && x.IsActive == true);
                return(View(vmMake));
            }
            else
            {
                MakeDAL.Add(make);
                return(RedirectToAction("Index", "Make"));
            }
        }
Beispiel #2
0
        public ActionResult Add()
        {
            VMMakeAdd vmMake      = new VMMakeAdd();
            Guid      teknolojiID = Guid.Parse("35391ff3-c30d-4a6a-b30b-14079eaaa455");

            vmMake.Categories = CategoryDAL.GetList(x => x.SubCategoryID == teknolojiID && x.IsActive == true);
            return(View(vmMake));
        }