public void Add(DomainModel.Locker locker) { if (locker == null) { throw new ArgumentNullException(nameof(locker)); } this.dbSet.Add(locker); }
private void ManageRental(Customer customer, DomainModel.Locker locker) { var lastCustomerActivity = this.unitOfWork.CustomerActivityRepository.GetByCustomer(customer); if (lastCustomerActivity != null) { lastCustomerActivity.FinalRentalDate = DateTime.Now; return; } var customerActivity = new CustomerActivity(customer, locker); this.unitOfWork.CustomerActivityRepository.Add(customerActivity); }
public LockerManagementResponse AddNewLocker(DomainModel.Locker locker) { try { this.unitOfWork.LockerRepository.Add(locker); this.unitOfWork.Commit(); return(new LockerManagementResponse(true)); } catch (Exception) { return(new LockerManagementResponse(false)); } }
public LockerManagementResponse AddArduinoDataInLocker(DomainModel.Locker locker) { try { var entityLocker = this.unitOfWork.LockerRepository.GetById(locker.LockerId); entityLocker.SetArduinoId(locker.ArduinoId); this.unitOfWork.Commit(); return(new LockerManagementResponse(true)); } catch (Exception) { return(new LockerManagementResponse(false)); } }
private IList <DomainModel.Locker> GenerateVerticalLockers(LockerBlock lockerBlock) { var lockers = new List <DomainModel.Locker>(); int lockerPosition = 1; for (int verticalPosition = 1; verticalPosition <= lockerBlock.TotalNumberOfVerticalLockers; verticalPosition++) { for (int horizontalPosition = 1; horizontalPosition <= lockerBlock.TotalNumberOfHorizontalLockers; horizontalPosition++) { var locker = new DomainModel.Locker(lockerBlock.LockerBlockId, verticalPosition, horizontalPosition, lockerPosition); lockers.Add(locker); lockerPosition++; } } return(lockers); }
public JsonResult AddNewLocker(DomainModel.Locker request) { var response = this.lockerManagement.AddNewLocker(request); return(Json(response)); }
public JsonResult AddArduinoDataInLocker(DomainModel.Locker locker) { var response = this.lockerManagement.AddArduinoDataInLocker(locker); return(Json(response)); }