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")); }
public async Task <IActionResult> InsertShoesColor(string id, string color) { ShoesColor shoesColor = new ShoesColor { ShoesId = int.Parse(id), ColorId = int.Parse(color) }; Shoes shoes = await shoesDao.GetObject(int.Parse(id)); try { await shoesColorDao.Insert(shoesColor); } catch (Exception e) { ViewBag.Error = e.Message; } await SettingVariable(); return(View("EditShoes", shoes)); }