Exemplo n.º 1
0
        public ActionResult Add(VMProduct model)
        {
            Product yeniUrun = new Product();

            ProductModel pm = ProductModelDAL.Get(x => x.ModelID == model.ModelID);

            yeniUrun.ModelID      = pm.ModelID;
            yeniUrun.Description  = model.Description;
            yeniUrun.IsActive     = true;
            yeniUrun.ProductID    = Guid.NewGuid();
            yeniUrun.ProductName  = model.ProductName;
            yeniUrun.UnitPrice    = model.UnitPrice;
            yeniUrun.UnitsInStock = model.UnitsInStock;
            yeniUrun.ViewCount    = 0;

            Guid     cID = pm.CategoryID;
            Category c   = CategoryDAL.Get(x => x.CategoryID == cID);

            foreach (Property item in c.Properties)
            {
                string valProp = Request.Form[item.PropertyID.ToString()];
                if (valProp != null)
                {
                    ProductTechnicProperty temp = new ProductTechnicProperty();

                    temp.PropertyID        = item.PropertyID;
                    temp.PropertyValue     = valProp;
                    temp.ProductPropertyID = Guid.NewGuid();
                    yeniUrun.ProductTechnicProperties.Add(temp);
                }
            }

            foreach (HttpPostedFileBase item in model.Picture)
            {
                if (item != null)
                {
                    string pic  = System.IO.Path.GetFileName(item.FileName);
                    string path = System.IO.Path.Combine(Server.MapPath("~/Assets/img/products"), pic);
                    // file is uploaded
                    item.SaveAs(path);

                    ProductPicture temp = new ProductPicture();

                    temp.ProductPictureID = Guid.NewGuid();
                    temp.PicturePath      = item.FileName;
                    temp.IsActive         = true;
                    yeniUrun.ProductPictures.Add(temp);
                }
            }

            ProductDAL.Add(yeniUrun);


            return(RedirectToAction("Add"));
        }
Exemplo n.º 2
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"));
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Hiển thị loại hàng theo mã
 /// </summary>
 /// <param name="categoryID"></param>
 /// <returns></returns>
 public static Category GetCategory(int categoryID)
 {
     return CategoryDB.Get(categoryID);
 }
 public Category GetById(int id)
 {
     return(_categoryDAL.Get(x => x.CategoryID == id));
 }
Exemplo n.º 5
0
 public Category GetById(int categoryID)
 {
     return(_categoryDal.Get(c => c.CategoryID == categoryID));
 }
Exemplo n.º 6
0
 public Category GetById(int id)
 {
     return(_categorydal.Get(x => x.CategoryId == id));
 }
Exemplo n.º 7
0
 public IDataResult <Category> GetById(int categoryId)
 {
     //Business codes
     return(new SuccessDataResult <Category>(_categoryDal.Get(filter: x => x.CategoryId == categoryId)));
 }
Exemplo n.º 8
0
        public JsonResult GetPropertiesByCategory(Guid id)
        {
            Category c = CategoryDAL.Get(x => x.CategoryID == id);

            return(Json(c.Properties.Select(x => new { x.PropertyID, x.PropertyName }), JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 9
0
 public Category Get(int entityID)
 {
     return(_dal.Get(a => a.CategoryID == entityID));
 }
Exemplo n.º 10
0
 public Category GetCategoryByID(int CategoryID)
 {
     return(_categoryDAL.Get(c => c.CategoryID == CategoryID));
 }
        public bool Delete(int entityID)
        {
            Category category = _categoryDAL.Get(a => a.CategoryID == entityID);

            return(_categoryDAL.Delete(category) > 0);
        }
Exemplo n.º 12
0
 public IDataResult <Category> GetById(int id)
 {
     return(new SuccessDataResult <Category>(_categoryDAL.Get(c => c.CategoryID == id)));
 }
Exemplo n.º 13
0
 /// <summary>
 /// Lấy thông tin 1 loại hàng hóa
 /// </summary>
 /// <param name="categoryId"></param>
 /// <returns></returns>
 public static Category GetCategory(int categoryId)
 {
     return(CategoryDB.Get(categoryId));
 }
Exemplo n.º 14
0
 public Categories getCategoryById(int categoryId)
 {
     return(_categoryDAL.Get(p => p.Id == categoryId));
 }
Exemplo n.º 15
0
 public IDataResult <Category> Get(int id)
 {
     return(new SuccessDataResult <Category>(categoryDAL.Get(a => a.ID == id)));
 }
        public bool Delete(int modelID)
        {
            Category category = _categoryDAL.Get(a => a.ID == modelID);

            return(_categoryDAL.Delete(category) > 0);
        }
Exemplo n.º 17
0
 public IDataResult <Category> GetById(int categoryId)
 {
     return(new SuccessDataResult <Category>(_categoryDal.Get(x => x.CategoryID == categoryId)));
 }
Exemplo n.º 18
0
 public Category GetByID(int entityID)
 {
     return(_categoryDAL.Get(a => a.ID == entityID));
 }
Exemplo n.º 19
0
        public void DeleteByID(int entityID)
        {
            Category category = _categoryDAL.Get(a => a.ID == entityID);

            Delete(category);
        }
Exemplo n.º 20
0
 public static Category GetCategory(int CategoryID)
 {
     return(CategoryDB.Get(CategoryID));
 }
Exemplo n.º 21
0
 public ResponseModel <Category> GetById(long id)
 {
     responseModel.result = _categoryDAL.Get(c => c.CategoryID == id);
     return(responseModel);
 }
        public void DeleteByID(int id)
        {
            Category cat = _dal.Get(a => a.CategoryID == id);

            _dal.Delete(cat);
        }
 public Categories Get(int ID)
 {
     return(_CategoryDAL.Get(x => x.ID == ID));
 }
Exemplo n.º 24
0
 public IDataResult <Category> GetById(int categoryid)
 {
     return(new SuccessDataResult <Category>(_ICategoryDAL.Get(c => c.CategoryId == categoryid)));
 }
Exemplo n.º 25
0
 public Category Get(int entityID)
 {
     return(serviceDAL.Get(x => x.ID == entityID));
 }
Exemplo n.º 26
0
 public Category GetById(int categoryId)
 {
     return(_iCategoryDal.Get(c => c.CategoryId == categoryId));
 }