示例#1
0
        public ActionResult Delete(int id)
        {
            BaseMakeVehicleService makeToDelete = new VehicleMakeService();

            makeToDelete.Delete(id);

            return(RedirectToAction("Index", "VehicleMakes"));
        }
 public ActionResult Delete(VehicleMakeView makes)
 {
     try
     {
         make.Delete(Mapper.Map <VehicleMake>(makes));
         return(RedirectToAction("Index"));
     }
     catch (Exception) { }
     return(RedirectToAction("Delete", makes.Id));
 }
        public async Task <HttpResponseMessage> Delete(VehicleMake vehicleMake)
        {
            if (!ModelState.IsValid)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, "Invalid data"));
            }

            VehicleMakeServ vehicleMakeServ = mapper.Map <VehicleMakeServ>(vehicleMake);
            bool            provjera        = await VehicleMakeService.Delete(vehicleMakeServ);

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