Exemplo n.º 1
0
        public ActionResult CurrentPriorityInformationPartial()
        {
            var             userId           = User.Identity.GetUserId();
            ApplicationUser currentAppClient = UserManager.Users.FirstOrDefault(x => x.Id == userId);
            var             carClient        = db.CarClientSet.FirstOrDefault(x => x.ClientClientId == currentAppClient.ClientGuid);

            if (carClient != null)
            {
                //if (carClient.PriorityBox != null)
                //{
                var priorityInformModel = new PriorityInformationViewModel();
                priorityInformModel.PriotityBox       = db.BoxesSet.FirstOrDefault(x => x.BoxId == carClient.PriorityBox);
                priorityInformModel.PriorityCarWasher = db.CarWasherSet.FirstOrDefault(x => x.CarWasherId == carClient.PriorityCarWasher);
                return(PartialView(priorityInformModel));
                //}
            }
            else
            {
                var priorityInformModel = new PriorityInformationViewModel();
                priorityInformModel.PriorityCarWasher = new CarWasher();
                priorityInformModel.PriotityBox       = new Boxes();

                priorityInformModel.PriotityBox.Description = "Не указан";
                priorityInformModel.PriorityCarWasher.Name  = "Не указан";
                return(PartialView(priorityInformModel));
            }
        }
Exemplo n.º 2
0
        public ActionResult PriorityInformationPartial(PriorityInformationViewModel model)
        {
            var             userId           = User.Identity.GetUserId();
            ApplicationUser currentAppClient = UserManager.Users.FirstOrDefault(x => x.Id == userId);
            var             carClient        = db.CarClientSet.FirstOrDefault(x => x.ClientClientId == currentAppClient.ClientGuid);

            carClient.PriorityBox       = model.PriotityBox.BoxId;
            carClient.PriorityCarWasher = model.PriorityCarWasher.CarWasherId;
            db.SaveChanges();

            return(RedirectToAction("ManageUser"));
        }
Exemplo n.º 3
0
        public ActionResult PriorityInformationPartial()
        {
            var             boxesList        = db.BoxesSet.ToList();
            var             carWashersList   = db.CarWasherSet.ToList();
            var             userId           = User.Identity.GetUserId();
            ApplicationUser currentAppClient = UserManager.Users.FirstOrDefault(x => x.Id == userId);

            var priorityInformModel = new PriorityInformationViewModel {
                Boxes      = boxesList,
                CarWashers = carWashersList, CurrentClient = currentAppClient.ClientGuid
            };

            return(PartialView(priorityInformModel));
        }