Example #1
0
 public ActionResult DeleteConfirmed(int id, Furniture furniture)
 {
     try
     {
         // TODO: Add delete logic here
         _furnitureRepository.FindAsync(id);
         _furnitureRepository.Delete(furniture);
         return(RedirectToAction("Index"));
     }
     catch
     {
         throw new ArgumentException(String.Format($"The {furniture.FurnitureName} could not be deleted"));
     }
     // return View();
 }
Example #2
0
 public IHttpActionResult Delete(int?id)
 {
     try
     {
         if (id == null)
         {
             return(NotFound());
         }
         _furnitureRepository.Delete(id);
         _unitOfWork.Complete();
         return(Ok());
     }
     catch (Exception)
     {
         return(InternalServerError());
     }
 }
Example #3
0
 public IActionResult DeleteConfirmed(int id)
 {
     _furnitureRepository.Delete(id);
     return(RedirectToAction(nameof(Index)));
 }