public ActionResult _BuildingQueueList() { QueueViewModel queueModel = new QueueViewModel(); queueModel.listModel = _queueService.GetQueue().Select(x => new ItemQueueViewModel { ID = x.ID, User_ID = x.User_ID, User_Login = x.Login, UserBuilding_ID = x.UserBuilding_ID, BuildingName = x.BuildingName, FinishDate = x.FinishTime, NewStatus = x.NewStatus }).ToList(); queueModel.allUser = _userService.GetUser().Select(x => x.Login).ToArray(); return View(queueModel); }
public ActionResult AddQueue(QueueViewModel queueModel) { List<string> errors; if (Session["val"] != null) { errors = ((string[])Session["val"]).ToList(); } else { errors = new List<string>(); } BuildingQueueDto _queueDto = new BuildingQueueDto(); _queueDto.Login = queueModel.viewModel.User_Login; _queueDto.UserBuilding_ID = queueModel.viewModel.UserBuilding_ID; _queueDto.NewStatus = queueModel.viewModel.NewStatus; if(_queueService.Add(_queueDto)) { errors.Add("Dodano budynek do kolejki."); } else { errors.Add("Błąd. Spróbuj ponownie."); } Session["val"] = errors.ToArray<string>(); return RedirectToAction("Admin"); }
public ActionResult UpdateQueue(QueueViewModel queueModel) { List<string> errors; if (Session["val"] != null) { errors = ((string[])Session["val"]).ToList(); } else { errors = new List<string>(); } BuildingQueueDto _buildingQueueDto = new BuildingQueueDto(); _buildingQueueDto.ID = queueModel.viewModel.ID; _buildingQueueDto.Login = queueModel.viewModel.User_Login; _buildingQueueDto.UserBuilding_ID = queueModel.viewModel.UserBuilding_ID; _buildingQueueDto.NewStatus = queueModel.viewModel.NewStatus; _buildingQueueDto.FinishTime = queueModel.viewModel.FinishDate; if(_queueService.Update(_buildingQueueDto)) { errors.Add("Zaktualizowano budynek w kolejce."); } else { errors.Add("Błąd. Spróbuj ponownie."); } Session["val"] = errors.ToArray<string>(); return RedirectToAction("Admin"); }