Пример #1
0
        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();
        }
Пример #2
0
        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));
        }
Пример #3
0
        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));
        }
Пример #4
0
        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));
        }
Пример #5
0
 public void DeleteParkingPlace(ParkingPlaceIdentityModel id)
 {
     this.ParkingPlaceDataAccess.Delete(id);
 }
Пример #6
0
 public ParkingPlace UpdateParkingPlace(ParkingPlaceIdentityModel id, ParkingPlaceUpdateModel place)
 {
     return(this.ParkingPlaceDataAccess.Update(id, place));
 }
Пример #7
0
 public ParkingPlace Get(ParkingPlaceIdentityModel id)
 {
     return(this.ParkingPlaceDataAccess.Get(id));
 }
Пример #8
0
        public void DeletePlace(int id)
        {
            var identityModel = new ParkingPlaceIdentityModel(id);

            PlaceDeleteService.DeleteParkingPlace(identityModel);
        }