コード例 #1
0
        public ActionResult DeletePlayer(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PlayersBm blogArticleBm = service.DeletePlayer(id);

            if (blogArticleBm == null)
            {
                return(HttpNotFound());
            }
            return(View(blogArticleBm));
        }
コード例 #2
0
        public async Task <IActionResult> Delete(int id)
        {
            if (id <= 0)
            {
                return(BadRequest("Not a valid player id"));
            }
            var player = await _playersService.GetPlayerById(id);

            if (player == null)
            {
                return(NotFound());
            }
            await _playersService.DeletePlayer(player);

            return(NoContent());
        }