public async void AddWorker() { var stringPayload = await Task.Run(() => JsonConvert.SerializeObject(WorkerToAdd.GetObject())); var httpContent = new StringContent(stringPayload, Encoding.UTF8, "application/json"); var response = await Dal.PostAsync(RestUrl, httpContent); if (response.IsSuccessStatusCode) { Workers.Add(WorkerToAdd); RaisePropertyChanged("AddWorker"); WorkerToAdd = new Worker(); RaisePropertyChanged("WorkerToAdd"); } }
public async void AddBill() { var stringPayload = await Task.Run(() => JsonConvert.SerializeObject(BillToAdd.GetObject())); var httpContent = new StringContent(stringPayload, Encoding.UTF8, "application/json"); var response = await Dal.PostAsync(RestUrl, httpContent); if (response.IsSuccessStatusCode) { Bills.Add(BillToAdd); RaisePropertyChanged("AddBill"); Revenue += BillToAdd.Car.Price - BillToAdd.Discount; RaisePropertyChanged("Revenue"); RaisePropertyChanged("Caluclate"); BillToAdd = new Bill(); RaisePropertyChanged("BillToAdd"); } }