public void Delete(ParkingPlaceIdentityModel id) { var placeToDelete = this.ApplicationContext.ParkingPlaces.Where(p => p.Id == id.Id).First(); this.ApplicationContext.Attach(placeToDelete); this.ApplicationContext.Remove(placeToDelete); this.ApplicationContext.SaveChanges(); }
public ParkingPlaceDTO UpdatePlace(int id, ParkingPlaceDTO place) { var identityModel = new ParkingPlaceIdentityModel(id); var updateModel = Mapper.Map <ParkingPlaceUpdateModel>(place); ParkingPlace res = PlaceUpdateService.UpdateParkingPlace(identityModel, updateModel); return(Mapper.Map <ParkingPlaceDTO>(res)); }
public Parking.ParkingPlace Update(ParkingPlaceIdentityModel id, ParkingPlaceUpdateModel place) { var existing = this.ApplicationContext.ParkingPlaces.Where(p => p.Id == id.Id).First(); var result = this.Mapper.Map(place, existing); this.ApplicationContext.Update(result); this.ApplicationContext.SaveChanges(); return(this.Mapper.Map <Parking.ParkingPlace>(result)); }
public Parking.ParkingPlace Get(ParkingPlaceIdentityModel id) { var result = this.ApplicationContext.ParkingPlaces.Where(p => p.Id == id.Id).First(); return(this.Mapper.Map <Parking.ParkingPlace>(result)); }
public void DeleteParkingPlace(ParkingPlaceIdentityModel id) { this.ParkingPlaceDataAccess.Delete(id); }
public ParkingPlace UpdateParkingPlace(ParkingPlaceIdentityModel id, ParkingPlaceUpdateModel place) { return(this.ParkingPlaceDataAccess.Update(id, place)); }
public ParkingPlace Get(ParkingPlaceIdentityModel id) { return(this.ParkingPlaceDataAccess.Get(id)); }
public void DeletePlace(int id) { var identityModel = new ParkingPlaceIdentityModel(id); PlaceDeleteService.DeleteParkingPlace(identityModel); }