예제 #1
0
        Models.Client.AccountModel ILoginHelper.GetClient(string clientLogin)
        {
            var dbData = (from clients c in _clientRepository.Clients
                          where c.Email.Equals(clientLogin)
                          select c).FirstOrDefault();

            var unReadNote = (from client_notyfications c in _clientRepository.ClientNotyfications
                              where c.Id_Client.Equals(dbData.Id) && c.AsRead == false
                              select c).ToArray();

            AccountModel accountModel = new AccountModel()
            {
                Id = dbData.Id,
                Login = dbData.Email,
                Name = dbData.Name,
                Surname = dbData.Surname,
                City_Id = dbData.Id_City,
                City = dbData.City.Name,
                Street = dbData.Street,
                PostalCode = dbData.PostalCode,
                DateOfBirth = dbData.DateOfBrith,
                UnreadNotifications = unReadNote.Length
            };

            return accountModel;
        }
예제 #2
0
        OrderModel IOrderHelper.GetOrderModel(Cart cart, AccountModel client)
        {
            var delivery = _ordersRepository.DictOrdersDelivery;
            var selectListItemDelivery = new List<SelectListItem>();
            var modelToReturn = new OrderModel();

            foreach (var item in delivery)
            {
                selectListItemDelivery.Add(new SelectListItem
                {
                    Text = item.Name + " - " + item.Price.ToString("c"),
                    Value = item.Id.ToString()
                });
            }

            modelToReturn.OrderDelivery = selectListItemDelivery;
            modelToReturn.cart = cart;
            modelToReturn.Client = client;
            modelToReturn.TotalPrice = cart.ComputeTotalValue();

            return modelToReturn;
        }
 void IAccountManagmentHelper.ChangeDeliveryData(AccountModel model)
 {
     _clientRepository.ChangePersonalData(model.Id, model.Street, model.PostalCode, model.City);
 }
예제 #4
0
        public ActionResult EditDeliveryData(AccountModel model)
        {
            _accountManagmentHelper.ChangeDeliveryData(model);
            var Client = _loginHelper.GetClient(model.Login);
            this.Session["Client"] = Client;

            Alert.SetAlert(AlertStatus.Info, "Wprowadzono zmiany");

            return RedirectToAction("AccountManagment");
        }