예제 #1
0
        public async Task Update(long id, UpdateGasStationModel model)
        {
            var gasStation = await dbContext.GasStations.GetAsync(id);

            gasStation.Update(model);
            await dbContext.SaveChangesAsync();
        }
예제 #2
0
        public async Task GasStation_UpdateName_GasStationNameIsUpdated()
        {
            // given

            var addGasStationModel = new AddGasStationModel {
                Name = "Łukoil"
            };
            var createdAt = await fixture.HttpClient.PostJsonAsync <CreatedResponse>(Routes.GasStations.ToString(), addGasStationModel);

            // when

            var updateGasStationModel = new UpdateGasStationModel {
                Name = "Amic Energy"
            };
            await fixture.HttpClient.PutJsonAsync($"{ Routes.GasStations }/{ createdAt.Id }", updateGasStationModel);

            // then

            var gasStation = await fixture.HttpClient.GetJsonAsync <GasStation>($"{ Routes.GasStations }/{ createdAt.Id }");

            gasStation.Name.Should().Be("Amic Energy");
        }
예제 #3
0
        public async Task <IActionResult> Update(long id, [FromBody] UpdateGasStationModel model)
        {
            await gasStationService.Update(id, model);

            return(NoContent());
        }
예제 #4
0
 internal void Update(UpdateGasStationModel model)
 {
     Name         = model.Name ?? Name;
     AddressLine1 = model.AddressLine1 ?? AddressLine1;
     AddressLine2 = model.AddressLine2 ?? AddressLine2;
 }