public ActionResult AddGood(AddGoodModel model) { if (ModelState.IsValid) { Good good = new Good { GoodName = model.GoodName, Manufacturer = model.Manufacturer, Category = model.Category, Price = model.Price, GoodCount = model.GoodCount, Photo = model.Photo }; using (var db = new ISHOpDB()) { db.Goods.Add(good); try { db.SaveChanges(); return(RedirectToAction("Index", "Admin")); } catch { } } } return(View(model)); }