コード例 #1
0
 public IActionResult Delete(int id, Car car)
 {
     if (id != car.Id)
     {
         return(BadRequest());
     }
     _repo.Delete(car);
     return(RedirectToAction(nameof(Index)));
 }
コード例 #2
0
        public IActionResult OnPost(int?id)
        {
            if (!id.HasValue)
            {
                return(NotFound());
            }

            if (Car.Id != id)
            {
                return(BadRequest());
            }
            _repo.Delete(Car);
            return(RedirectToPage("./Index"));
        }
コード例 #3
0
        public IActionResult OnPost(int?id)
        {
            if (!id.HasValue)
            {
                return(NotFound());
            }

            if (Car.Id != id)
            {
                return(BadRequest());
            }
            try
            {
                _repo.Delete(Car);
                return(RedirectToPage("./Index"));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError(string.Empty, ex.Message);
                return(Page());
            }
        }
コード例 #4
0
 public IActionResult Delete(int id, Car car)
 {
     _repo.Delete(car);
     return(RedirectToAction(nameof(Index)));
 }
コード例 #5
0
 public IActionResult Delete(int id, byte[] timeStamp)
 {
     _repo.Delete(id, timeStamp);
     return(RedirectToAction(nameof(Index)));
 }
コード例 #6
0
 public bool Remove(int id)
 {
     return(_carRepo.Delete(id));
 }