Ejemplo n.º 1
0
        public JsonResult AddModal(VMMakeModal model, List <Guid> CategoryList)
        {
            Make temp = MakeDAL.Get(x => x.MakeName == model.MakeName);

            if (temp != null)
            {
                foreach (Guid item in CategoryList)
                {
                    CategoryDAL.Get(x => x.CategoryID == item).Makes.Add(temp);
                }
                CategoryDAL.Save();
            }
            else
            {
                temp          = new Make();
                temp.MakeID   = Guid.NewGuid();
                temp.MakeName = model.MakeName;
                temp.IsActive = true;

                foreach (Guid item in CategoryList)
                {
                    temp.Categories.Add(CategoryDAL.Get(x => x.CategoryID == item));
                }

                MakeDAL.Add(temp);
            }
            return(Json(true));
        }
Ejemplo n.º 2
0
        public ActionResult AddModal(Guid id)
        {
            VMMakeModal model = new VMMakeModal();

            model.Category   = CategoryDAL.Get(x => x.CategoryID == id);
            model.Categories = CategoryDAL.GetList();
            return(PartialView(model));
        }