Exemplo n.º 1
0
        public async Task <ActionResult <Weapon> > PostWeapon(Weapon weapon)
        {
            await _weapon.Create(weapon);

            await _log.CreateLog(HttpContext, User.FindFirst("UserName").Value);

            return(CreatedAtAction("GetWeapon", new { id = weapon.Id }, weapon));
        }
        public async Task <IActionResult> Create([Bind("Id,Name,Type,BaseDamage")] Weapon weapon)
        {
            if (ModelState.IsValid)
            {
                await _weapon.Create(weapon);

                return(RedirectToAction(nameof(Index)));
            }
            return(View(weapon));
        }