public async Task <IActionResult> PutPlayer(int id, Player player)
        {
            if (id != player.Id)
            {
                return(BadRequest());
            }

            _context.Entry(player).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PlayerExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Beispiel #2
0
 public async Task <JsonResult> Create([Bind("Content, PlayerId, Email")] Comment comment)
 {
     if (ModelState.IsValid)
     {
         _context.Add(comment);
         await _context.SaveChangesAsync();
     }
     return(Json("success"));
 }
Beispiel #3
0
        public async Task <IActionResult> Create([Bind("Name, Image, Description, Gender, Phone, Email, Price")] Player player)
        {
            if (ModelState.IsValid)
            {
                _context.Add(player);
                await _context.SaveChangesAsync();

                return(Json("success"));
            }
            else
            {
                return(Json("failed"));
            }
        }
Beispiel #4
0
        public async Task <IActionResult> DeleteConfirmed(int id)
        {
            var player = await _context.Player.FindAsync(id);

            _context.Player.Remove(player);
            await _context.SaveChangesAsync();

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