public void AddStore(ComicStore store) { var tri = _db.ComicStore.FirstOrDefault(x => x.Location == store.Location); if (tri == null) { _db.Add(store); _db.SaveChanges(); } else { throw new ArgumentException("A store of that name already exists."); } }
public ActionResult Create(ComicStoreModelView store) { try { var stor = new ET.ComicStore.Library.ComicStore { Location = store.Location }; ComicDB.AddStore(stor); int stores = ComicDB.GetStores().Last().StoreId; ComicDB.AddInventory(stores); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }