예제 #1
0
        /// <summary>
        /// Profile Directory
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Unique(Guid?id, string key = null)
        {
            if (!id.HasValue && string.IsNullOrWhiteSpace(key))
            {
                return(RedirectToAction("Index"));
            }

            var callerId = User.IdentifierSafe();

            var profile = new ProfileMaster()
            {
                Display = profileCore.SearchSingle(id, key, callerId),
            };

            if (null != profile.Display)
            {
                profile.Display.Badges = badgeCore.Search(profile.Display.Identifier);

                profile.Display.Activities = activityCore.UserSearch(profile.Display.Identifier);

                profile.Display.Items = itemCore.Search(profile.Display.Identifier, null, null, short.MaxValue, callerId);

                profile.ItemRequests = itemRequestCore.Search(profile.Display.Identifier, callerId);

                profile.Lent = from s in this.borrowCore.Lent(profile.Display.Identifier)
                               where s.Status == BorrowStatus.Returned
                               select s;
                profile.Borrowed = from s in this.borrowCore.Borrowed(profile.Display.Identifier)
                                   where s.Status == BorrowStatus.Returned
                                   select s;

                return(View(profile));
            }
            else if (!string.IsNullOrWhiteSpace(key))
            {
                return(Redirect(ProfileCore.SearchUrl(key, "unknown_key")));
            }
            else
            {
                return(RedirectToAction("index"));
            }
        }
예제 #2
0
        // GET: /Dashboard/Friends
        public ActionResult Friends()
        {
            var userId    = User.Identifier();
            var dashboard = this.profileCore.Load <ProfileMaster>(userId);

            var master = new ProfileMaster()
            {
                Display = profileCore.SearchSingle(userId, null, userId),
            };

            master.Friends = profileCore.Friends(master.Display, short.MaxValue);

            master.Manifest = (from p in master.Friends
                               where p.Longitude != 0 && p.Latitude != 0
                               select p).ToList();

            dashboard.Info = master;

            return(View(dashboard));
        }
        public async Task <IActionResult> Post(ProfileMaster profile)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var response = await service.CreateAsync(profile);

                    return(Ok(response));
                }
                else
                {
                    return(BadRequest(ModelState));
                }
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }