private void RefreshRow(VehicleDto oldEmployee)
 {
     int index = Vehicles.IndexOf(SelectedVehicle);
     Vehicles.Remove(SelectedVehicle);
     Vehicles.Insert(index, oldEmployee);
     SelectedVehicle = oldEmployee;
 }
 /// <summary>
 /// Aktualizuje pojazd o podanym ID.
 /// </summary>
 /// <param name="vehicle"></param>
 /// <returns></returns>
 public async Task UpdateVehicle(VehicleDto vehicle)
 {
     await Put(vehicle);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Aktualizuje pojazd w bazie danych.
 /// </summary>
 /// <param name="vehicle"></param>
 /// <returns></returns>
 public IHttpActionResult Put(VehicleDto vehicle)
 {
     if (!ModelState.IsValid)
     {
         return BadRequest();
     }
     var oldVehicle = context.Vehicles.Find(vehicle.Id);
     if (oldVehicle == null)
     {
         return NotFound();
     }
     Mapper.Map(vehicle, oldVehicle);
     context.SaveChanges();
     return Ok();
 }