Пример #1
0
        /// <summary>
        /// Delete Vehicle Model
        /// </summary>
        public void DeleteVehicleModel(long vehicleModelId)
        {
            VehicleModel dbversion = vehicleModelRepository.Find(vehicleModelId);

            CheckVehicleModelAssociations(vehicleModelId);
            if (dbversion == null)
            {
                throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture,
                                                                  "Vehicle Model with Id {0} not found!", vehicleModelId));
            }
            vehicleModelRepository.Delete(dbversion);
            vehicleModelRepository.SaveChanges();
        }
Пример #2
0
        public ActionResult Delete(int?Id)
        {
            if (Id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var model = service.Delete(Id);

            if (model == null)
            {
                return(HttpNotFound());
            }
            return(View(model));
        }
Пример #3
0
        public async Task <bool> DeleteVehicleModel(object id)
        {
            try
            {
                await _vehicleModelRepository.Delete(id);

                await _unitOfWork.SaveChangesAsync();

                return(true);
            }
            catch
            {
                return(false);
            }
        }
Пример #4
0
 public async Task <int> DeleteVehicleModel(IVehicleModelDomainModel entity)
 {
     return(await _vehicleModelRepository.Delete(entity));
 }