public async Task update([FromBody] RentInput rent)
 {
     if (ModelState.IsValid)
     {
         await _rentService.update(rent);
     }
 }
Exemple #2
0
 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));
 }
Exemple #4
0
        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)));
        }
Exemple #5
0
 public async Task update(RentInput rent)
 {
     await _rentRepository.update(new Rent(rent));
 }
Exemple #6
0
 public async Task <ActionResult <RentOutput> > create(RentInput rent)
 {
     return(await _createRentService.create(rent));
 }