Beispiel #1
0
        public ActionResult Delete(int id)
        {
            BaseModelVehicleService modelToDelete = new VehicleModelService();

            modelToDelete.Delete(id);

            return(RedirectToAction("Index", "VehicleModels"));
        }
Beispiel #2
0
 public ActionResult Delete(VehicleModelView models)
 {
     try
     {
         model.Delete(Mapper.Map <VehicleModel>(models));
         return(RedirectToAction("Index"));
     }
     catch (Exception) { }
     return(RedirectToAction("Delete", models.Id));
 }
 public ActionResult Delete(int id, IFormCollection collection)
 {
     try
     {
         Response response = VehicleModelService.Delete(id);
         ViewBag.Response = response;
     }
     catch
     {
         return(RedirectToAction("Index"));
     }
     return(RedirectToAction("Index"));
 }
        public async Task <HttpResponseMessage> Delete(VehicleModel vehicleModel)
        {
            if (!ModelState.IsValid)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, "Invalid data"));
            }

            VehicleModelServ vehicleModelServ = mapper.Map <VehicleModelServ>(vehicleModel);
            bool             provjera         = await VehicleModelService.Delete(vehicleModelServ);

            if (provjera)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, "Vehicle model is successfully deleted!"));
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.Conflict, "Vehicle model is not deleted!"));
            }
        }