public async Task CreateAsync(CarSaveModel carModel) { var car = new Car(); carModel.ApplyToEntity(car, dataStore, positionService); await dataStore.SaveAsync(car); }
public void Create(CarSaveModel carModel) { var car = new Car(); carModel.ApplyToEntity(car, dataStore, positionService); dataStore.Save(car); }
public void Update(long id, CarSaveModel carModel) { var car = dataStore.Get <Car>(id); if (car == null) { throw new EntityNotFoundException($"Запись типа {typeof(Car).Name} c идентификатором {id} не существует"); } carModel.ApplyToEntity(car, dataStore, positionService); dataStore.SaveChanges(); }