예제 #1
0
        public async Task <IActionResult> CreateExecute(Shoes shoes, string maker, string category, string origin,
                                                        string size, string color, string price)
        {
            var    files    = HttpContext.Request.Form.Files;
            var    file     = files[0];
            string filename = shoes.Id + ".jpeg";

            await SaveImage(shoes.Id, file);

            shoes.MakerId   = int.Parse(maker);
            shoes.CountryId = int.Parse(origin);
            shoes.CateId    = int.Parse(category);
            Image image = new Image
            {
                ShoesId = shoes.Id,
                ImageId = 0,
                Link    = filename
            };
            Price shoesprice = new Price
            {
                ShoesId    = shoes.Id,
                ShoesPrice = float.Parse(price)
            };
            ShoesColor shoesColor = new ShoesColor
            {
                ColorId = int.Parse(color),
                ShoesId = shoes.Id
            };
            ShoesSize shoesSize = new ShoesSize
            {
                ShoesId = shoes.Id,
                Vnsize  = float.Parse(size)
            };
            await shoesDao.Insert(shoes);

            await imageDao.Insert(image);

            await priceDao.Insert(shoesprice);

            await shoesColorDao.Insert(shoesColor);

            await shoesSizeDao.Insert(shoesSize);

            return(RedirectToAction("CreateShoes", "ShoesManage"));
        }
예제 #2
0
        public async Task <IActionResult> InsertShoesSize(string id, string vnsize)
        {
            ShoesSize shoesSize = new ShoesSize
            {
                ShoesId = int.Parse(id),
                Vnsize  = float.Parse(vnsize)
            };
            Shoes shoes = await shoesDao.GetObject(int.Parse(id));

            try
            {
                await shoesSizeDao.Insert(shoesSize);
            }
            catch (Exception e)
            {
                ViewBag.Error = e.Message;
            }
            await SettingVariable();

            return(View("EditShoes", shoes));
        }