// CREATE public async Task <bool> CreateArmourAsync(ArmourCreate model) { Armour entity = new Armour(model.Name, model.WeightInPounds, model.CostInCurrency, model.CurrencyEnumIndex, model.ArmourClass, model.MaxDexMod, model.MinStrength, model.StealthDisadvantage, model.ArmourType); _context.Armours.Add(entity); return(await _context.SaveChangesAsync() == 1); }
public async Task <ActionResult> Create(ArmourCreate model) { if (ModelState.IsValid) { var service = GetArmourService(); if (await service.CreateArmourAsync(model)) { return(RedirectToAction(nameof(Index))); } } return(View(model)); }