Пример #1
0
 public IActionResult DeleteMonster(int id)
 {
     if (monsterService.Delete(id))
     {
         return(Content("Deleted successfully"));
     }
     else
     {
         return(BadRequest());
     }
 }
        //Delete功能
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(HttpNotFound());
            }
            monsterService = new MonsterService();
            var chk = monsterService.Delete((int)id);

            if (chk)
            {
                return(RedirectToAction("Index"));
            }
            else
            {
                return(HttpNotFound());
            }
        }