示例#1
0
 JsonResult IDriver.GetAddressBook()
 {
     try
     {
         UserAddressBookResponse addressBook = this.service.GetAddressBook("", AddressBookSort.ContactNameASC, AddressBookFilter.All, Guid.Empty, token, 0);
         return(Json(addressBook));
     }
     catch (Exception ex)
     {
         return(Error.Message("Connector.WebDavDriver: Ошибка сервиса при получении адресной книги!"));
     }
 }
示例#2
0
 public AddressBookModel(UserAddressBookResponse data)
 {
     Contacts = new Contacts();
     Contacts.UserContacts = data.Contacts;
 }
示例#3
0
        public ActionResult ContactList(Guid?userId)
        {
            string status = "";
            Guid   token  = CheckSessionAuthState(CurrentUser, _authService);

            if (token == Guid.Empty)
            {
                status = "logoff";
                var modelr = new AddressBookModel();
                modelr.Status = status;
                return(View(modelr));
                //return RedirectToAction("LogOff", "Account");
            }
            UserAddressBookResponse response = _cryptxService.GetAddressBook("", AddressBookSort.ContactNameASC,
                                                                             AddressBookFilter.All, (userId == null ? Guid.Empty : (Guid)userId), token, 0);
            var model = new AddressBookModel(response);

            model.Status = status;

            var navigation = new MyNavigation();

            if (userId != null && userId != Guid.Empty)
            {
                navigation.Navigations.Add(new NavElement
                {
                    Depth      = 1,
                    Name       = "Администрирование",
                    Action     = "Index",
                    Controller = "Administration",
                    IsUrl      = true
                });
                UserInfoResponse responseUser = _authService.GetUserDataByID((Guid)userId);
                navigation.Navigations.Add(new NavElement
                {
                    Depth = 3,
                    Name  = responseUser.User.Name,
                    IsUrl = false
                });
                navigation.Navigations.Add(new NavElement
                {
                    Depth = 4,
                    Name  = "Список контактов",
                    IsUrl = false
                });
            }
            else
            {
                navigation.Navigations.Add(new NavElement
                {
                    Depth      = 1,
                    Name       = "Адресная книга",
                    Action     = "Index",
                    Controller = "AddressBook",
                    IsUrl      = false
                });
            }
            navigation.Navigations = navigation.Navigations.OrderBy(x => x.Depth).ToList();
            ViewBag.nav            = Helper.HtmlNavElement(navigation, Request.RequestContext);
            ViewBag.UserId         = userId == null ? Guid.Empty : (Guid)userId;


            return(View(model));
        }