public ActionResult AddClothes(RegisterClothesViewModel model, HttpPostedFileBase uploadFile)
 {
     if (uploadFile != null && uploadFile.ContentLength > 0)
     {
         var    fileName = Path.GetFileName(uploadFile.FileName);
         string photoUrl = System.DateTime.Now.ToString("ddMMyyhhmmss_") + fileName;
         model.PictureUrl = photoUrl;
         uploadFile.SaveAs(Server.MapPath(photoUrl));
         this.clothesService.AddClothes(model);
     }
     return(RedirectToAction("Index", "Home"));
 }
        public void AddClothes(RegisterClothesViewModel model)
        {
            var clothes = new Clothes()
            {
                Name        = model.Name,
                Type        = model.Type,
                Quantity    = model.Quantity,
                Size        = model.Size,
                SinglePrice = model.SinglePrice,
                PictureUrl  = model.PictureUrl,
                Description = model.Description
            };

            this.dbContext.Clothes.Add(clothes);
            this.dbContext.SaveChanges();
        }