public async Task Update(UpdateBillDto dto) { var bill = await _billRepository.Get(dto.BillId); var amount = _amountFactory.Create(dto.AmountValue, dto.Currency); var supplier = await GetSupplier(dto.SupplierId); var category = await GetCategory(dto.CategoryId); bill.Update(dto.Name, amount, dto.PaymentDate, dto.PaymentStatus, supplier, category); await _billRepository.Update(bill); }
public async Task BillService_ShouldUpdateBill() { var bill = new UpdateBillDto() { BillId = 1, Name = "rquestBill", AmountValue = 12, CategoryId = 6, Currency = Currency.PLN, PaymentDate = DateTime.Now.AddDays(2), SupplierId = 5 }; var content = new StringContent(JsonConvert.SerializeObject(bill), Encoding.UTF8, "application/json"); var response = await _client.PutAsync("api/bills", content); Assert.Contains("200", response.EnsureSuccessStatusCode().ToString()); }
public async Task Put([FromBody] UpdateBillDto dto) { await _billService.Update(dto); }