public async Task update([FromBody] RentInput rent) { if (ModelState.IsValid) { await _rentService.update(rent); } }
public Rent(RentInput rentInput) { Id = rentInput.Id; RentDate = rentInput.RentDate; rentExpirationDate = rentInput.rentExpirationDate; Status = rentInput.Status; FullPrice = rentInput.FullPrice; CustomerId = rentInput.CustomerId; Customer = rentInput.Customer; Items = new List <RentItem>(rentInput.Items); }
public async Task <ActionResult> create([FromBody] RentInput rent) { if (ModelState.IsValid) { if (await _rentService.create(rent) != null) { return(this.StatusCode(200)); } return(this.StatusCode(500)); } return(this.StatusCode(500)); }
public async Task <ActionResult <RentOutput> > create(RentInput rent) { foreach (var item in rent.Items) { if (!(await _validateItemStock.validate(new RentItemInput(item)))) { return(null); } item.laptop = (await _laptopRepository.findByIdAsync(item.laptopId)).Value; } rent.Status = "efetuado"; await _rentRepository.addAsync(new Rent(rent)); rent.Customer = await _customerRepository.findByIdAsync(rent.CustomerId); return(new RentOutput(new Rent(rent))); }
public async Task update(RentInput rent) { await _rentRepository.update(new Rent(rent)); }
public async Task <ActionResult <RentOutput> > create(RentInput rent) { return(await _createRentService.create(rent)); }