public IActionResult MakingAnOrder() { Cart cart = new Cart(); cart.GetFromCoockie(HttpContext); if ((cart?.OrderLine?.Count() ?? 0) == 0) { ModelState.AddModelError("", "The shopping cart is empty"); return(RedirectToAction("ShowCart", "Cart")); } List <Worker> workers = _workerServises.Read(); List <FullUser> users = new List <FullUser>(); foreach (var item in workers) { users.Add(_fullUserServices.Read(item.PassportNumber)); } ViewData["Master"] = users.Where(x => x.Roles.Count(y => y.Title.Equals("Master")) != 0); ViewData["Manager"] = users.Where(x => x.Roles.Count(y => y.Title.Equals("Manager")) != 0); ViewData["Client"] = _clientServices.Read(); FullUser user = new FullUser(); user.GetUserFromCookie(HttpContext); ViewBag.ManagerId = user.Worker.PassportNumber; return(View()); }
public ActionResult StartRoleChoosing(string login, string password) { FullUser fullUser = null; try { fullUser = _fullUserServices.Read(login, password); } catch (ArgumentException) { return(RedirectToAction(nameof(Index), new { attend = 1 })); } SaveUserData(fullUser); return(RedirectToAction("RoleChoosing")); }
public ActionResult EditWorker(int workerNumber) => View(_fullUserServices.Read(workerNumber).ConvertToChenged(_roleServices.Read()));