Example #1
0
        // 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);
        }
Example #2
0
 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));
 }