public ActionResult Details(int id, VehicleModelViewModel collection)
 {
     try
     {
         if (id > 0)
         {
             collection.UpdaterId = LogedInAdmin.Id;
             _vehicleModelService.Delete(_mapper.Map <VehicleModel>(collection));
             return(RedirectToAction("Index"));
         }
         ModelState.AddModelError(string.Empty, GeneralMessages.EmptyId);
     }
     catch (Exception ex)
     {
         _logger.Error(ex);
         if (ex.InnerException != null && ex.InnerException.Source.Equals(GeneralMessages.ExceptionSource))
         {
             ModelState.AddModelError(string.Empty, ex.Message);
         }
         else
         {
             ModelState.AddModelError(string.Empty, GeneralMessages.UnexpectedError);
         }
     }
     return(View(collection));
 }
Example #2
0
 public async Task <ActionResult <VehicleModelForReturnDto> > Delete(int itemId)
 {
     return(await vehicleModelService.Delete(itemId));
 }