コード例 #1
0
        public async Task <IActionResult> Delete(int id)
        {
            try
            {
                var _Area = await areaRepo.Select(id);

                if (_Area.Id == 0)
                {
                    return(NotFound("Esta Area não existe ou já foi removido."));
                }

                await areaRepo.Delete(id);

                return(StatusCode(StatusCodes.Status200OK));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, new Messages(ex.Message)));
            }
        }
コード例 #2
0
 public ActionResult Remove(int id)
 {
     areaRepository.Delete(areaRepository.Get(id));
     return(RedirectToAction("AreaList", "Area"));
 }