ARUTMLTH (nuget): Microsoft.AspNetCore.Mvc.NewtonsoftJson  services.AddControllers().AddNewtonsoftJson(o => o.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore);  Dotnet controller [FromQuery] ?sort=asc  using var transaction = Context.Database.BeginTransaction(); 	bike.Id = id; 	var c = await Context.Bikes.FindAsync(id); 	Context.Bikes.Remove(c); 	Context.Bikes.Add(bike); 	await Context.SaveChangesAsync(); 	await transaction.CommitAsync(); 	 var startedRental = await Context.Rentals.FirstAsync(); startedRental.End = System.DateTime.Now; startedRental.TotalCosts = CostCalculation.CalculateTotalCost(startedRental); startedRental.Customer = await Context.Customers.FindAsync(rental.CustomerID); startedRental.Bike = await Context.Bikes.FindAsync(rental.BikeID); Context.Rentals.Update(startedRental); await Context.SaveChangesAsync();  var result=await unpaid 	.Include(c => c.Customer) 	.Select(item => new { item.CustomerID, item.Customer.LastName, item.Customer.FirstName, item.Id, item.Begin, item.End }) 	.ToListAsync();  return (await dataContext.Deposits.Include("Membership.Member").ToArrayAsync()) 	.GroupBy(d => new { d.Membership.Begin.Year, d.Membership.Member }) 	.Select(i => new DepositStatistics 	{ 	 Year = i.Key.Year, 	 Member = i.Key.Member, 	 TotalAmount = i.Sum(d => d.Amount) 	}); using var transaction = Database.BeginTransaction(); 	await Database.ExecuteSqlRawAsync("DELETE FROM Taxis"); 	await Database.ExecuteSqlRawAsync("DELETE FROM Drivers"); 	await Database.ExecuteSqlRawAsync("DELETE FROM Rides"); 	await transaction.CommitAsync(); var result = await Rides.Where(e => e.Start.Year == year and e.Start.Month == month).ToListAsync();          	var drivers=result.GroupBy(d => d.Driver); 	var ret=drivers.Select(b => new DriverStatistics 	{ 		DriverName = b.Key.Name, 		TotalCharge = b.Sum(d => d.Charge) ?? 0 	}); public async Task T> GetFromServiceAsync T>(string path) {  	var response = await client.GetStringAsync(BASE_URL + path); 	return JsonSerializer.Deserialize T>(response, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }); } public async Task HttpResponseMessage> PostToServiceAsync T>(string path, T payload ) { 	var body = new StringContent(JsonSerializer.Serialize T>(payload), Encoding.UTF8, "application/json"); 	var response = await client.PostAsync(BASE_URL + path,body); 	return response; }			 WPF GUI BindableBase Customers customers = new Customers(Customer, client); customers.Show(); MainWindow.Close.Execute();   	ComboBox ItemsSource="{Binding Taxis}" DisplayMemberPath="LicensePlate" SelectedItem="{Binding SelectedTaxi}" /> 	UpdateSourceTrigger=PropertyChanged DataGrid Name="TaskTable" ItemsSource="{Binding Tasks}" RowEditEnding="TaskTable_RowEditEnding" AutoGenerateColumns="False" > 	DataGrid.Columns> 		DataGridTextColumn Header="TaskId"  Binding="{Binding TaskId, UpdateSourceTrigger=LostFocus}"/> 	 public async void TaskTable_RowEditEnding(object sender, DataGridRowEditEndingEventArgs e) { 	var task = e.Row.Item as Task; 	await GetTasks(); 	if (task != null and task.Name == String.Empty) 	{ 		var result = await client.DeleteToServiceAsync("Tasks/" + task.TaskId); 		MessageBox.Show("DELETE" + result.StatusCode.ToString()); 	} 	else if (Tasks.Any(b => b.TaskId == task.TaskId)) 	{ 		var result = await client.PutToServiceAsync("Tasks/" +task.TaskId, task); 		MessageBox.Show("EDIT" + result.StatusCode.ToString()); 	} 	else 	{ 		var result = await client.PostToServiceAsync("Tasks" , task); 		MessageBox.Show("ADD" + result.StatusCode.ToString()); 	} 	await GetTasks(); }
Keywords: BEST|EVER