public bool Delete(VehicleMake vehicleMake)
 {
     if (vehicleMake == null || !ModelState.IsValid)
     {
         throw new HttpException((int)HttpStatusCode.BadRequest, "Invalid Request");
     }
     vehicleMakeService.DeleteVehicleMake(vehicleMake.VehicleMakeId);
     return(true);
 }
Exemple #2
0
        public async Task <IHttpActionResult> DeleteVehicleMake(int id)
        {
            IVehicleMake vehicleMake = await _vehicleService.FindVehicleMake(id);

            if (vehicleMake == null)
            {
                return(NotFound());
            }

            await _vehicleService.DeleteVehicleMake(id);

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemple #3
0
        public async Task <ActionResult <ReadVehicleMake> > DeleteMake(Guid id)
        {
            var deletedVehicleMake = await service.DeleteVehicleMake(id);

            if (deletedVehicleMake == null)
            {
                return(NotFound("Vehicle make not found."));
            }

            var deletedVehicleMakeRestModel = mapper.Map <ReadVehicleMake>(deletedVehicleMake);

            return(Ok(deletedVehicleMakeRestModel));
        }
Exemple #4
0
        public async Task <HttpResponseMessage> DeleteVehicleMake(Guid id)
        {
            var vehicleMake = Mapper.Map <VehicleMakeViewModel>(await _vehicleMakeService.GetIdVehicleMake(id));

            if (vehicleMake == null)
            {
                return(Request.CreateResponse(HttpStatusCode.NotFound, "vehicle maker not found"));
            }

            var removeVehicleMake = await _vehicleMakeService.DeleteVehicleMake(Mapper.Map <VehicleMakeDomainModel>(vehicleMake));

            return(Request.CreateResponse(HttpStatusCode.OK, removeVehicleMake));
        }
Exemple #5
0
        public ActionResult Delete(int?Id)
        {
            if (Id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var model = service.DeleteVehicleMake(Id);

            if (model == null)
            {
                return(HttpNotFound());
            }
            return(View(model));
        }
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            try
            {
                VehicleMake vehicleMake = await _vehicleMakeService.GetVehicleMakeByIDAsync(id);

                await _vehicleMakeService.DeleteVehicleMake(vehicleMake);
            }

            catch (DataException)
            {
                return(RedirectToAction("Delete", new { id, saveChangesError = true }));
            }

            return(RedirectToAction("Index"));
        }
 public ActionResult Delete(int id)
 {
     _vehicleMakeService.DeleteVehicleMake(id);
     _vehicleMakeService.SaveVehicleMake();
     return(RedirectToAction("Index"));
 }