public async Task <IActionResult> Rent([FromBody] EquipmentForRentDto equipmentForRentDto)
        {
            var equipmentRent = new EquipmentsRent();

            equipmentRent.E_ID        = equipmentForRentDto.E_ID;
            equipmentRent.Rent_by     = equipmentForRentDto.Rent_by;
            equipmentRent.Rent_time   = int.Parse(DateTime.Now.ToString("yyyyMMdd")); //yyyyMMddHHmmss
            equipmentRent.Rent_status = "inuse";
            await _context.EquipmentsRent.AddAsync(equipmentRent);

            User user = await _context.Users.FindAsync(equipmentForRentDto.Rent_by);

            user.Rented = 1;

            Equipments Equipments = await _context.Equipments.FindAsync(equipmentForRentDto.E_ID);

            Equipments.E_amount -= 1;
            Equipments.E_used   += 1;
            await _context.SaveChangesAsync();

            return(StatusCode(201));
        }
        public async Task <IActionResult> getReserv([FromBody] int resvid)
        {
            EquipmentsReserve ResvItem = await _context.EquipmentsReserve.FindAsync(resvid);

            User user = await _context.Users.FindAsync(ResvItem.Resv_by);

            Equipments Equipments = await _context.Equipments.FindAsync(ResvItem.E_ID);

            EquipmentForRentDto rentItem = new EquipmentForRentDto();

            user.Reserved        = 0;
            Equipments.E_resv   -= 1;
            Equipments.E_amount += 1;
            ResvItem.Resv_status = "rented";
            rentItem.E_ID        = ResvItem.E_ID;
            rentItem.Rent_by     = ResvItem.Resv_by;

            await _context.SaveChangesAsync();

            await Rent(rentItem);

            return(StatusCode(201));
        }