示例#1
0
        public ActionResult AddClothes(ClothModelView cm)
        {
            try
            {
               // Guid d=System.Guid.Parse(b8dc0c86-4e18-4807-a94e-44c0b51069ac);
                System.Data.Objects.ObjectParameter newClothesId = new System.Data.Objects.ObjectParameter("NewClothesId", 0);
                uCEntities.InsertNewClothes(cm.Name, cm.Description,getUserId(), cm.Price, cm.Sex, cm.Condition, cm.BrandName, cm.ColorId, cm.SizeId, cm.Quantity, cm.TypeId, System.DateTime.Now, cm.MaterialId, cm.PatternId, cm.IsVintage, cm.SubTypeId, newClothesId);

                if (cm.PhotoNameF != null)
                    { uCEntities.InsertPicture("F", databaseFilePut(cm.PhotoNameF), (int)newClothesId.Value); deleteFile(cm.PhotoNameF); }
                if (cm.PhotoNameB != null)
                    { uCEntities.InsertPicture("B", databaseFilePut(cm.PhotoNameB), (int)newClothesId.Value); deleteFile(cm.PhotoNameB); }
                if (cm.PhotoNameD0 != null)
                    { uCEntities.InsertPicture("D0", databaseFilePut(cm.PhotoNameD0), (int)newClothesId.Value); deleteFile(cm.PhotoNameD0); }
                if (cm.PhotoNameD1 != null)
                    { uCEntities.InsertPicture("D1", databaseFilePut(cm.PhotoNameD1), (int)newClothesId.Value); deleteFile(cm.PhotoNameD1); }

                uCEntities.SaveChanges();

                TempData["Message"] = string.Format("Ubranie zostało dodane");
                return RedirectToAction("Index", "Home");// ("Detail");

            }
            catch (Exception e)
            {
                //return View();
                return null;
                //return View("AddClothes2");
            }
        }
示例#2
0
 public ActionResult AddClothes2(ClothModelView cm/*, HttpPostedFileBase Picture*/)
 {
     return null;
 }