Ejemplo n.º 1
0
        /// <summary>
        /// Action to list the users causes.
        /// </summary>
        /// <param name="id">a user profile ID</param>
        /// <returns></returns>
        public ActionResult Projects( int id = -1 )
        {
            using (userProfileRepository)
            {
                var userProfile = id != -1
                    ? userProfileRepository.GetUserProfileByID(id)
                    : userProfileRepository.FindUserProfileByEmail(User.Identity.Name).FirstOrDefault();

                if (userProfile != null)
                {
                    var causes = causeRepository.FindCausesByUserProfileID(userProfile.UserProfileID);
                    var model = new UserProfileProjectsModel
                                    {
                                        UserProfileID = userProfile.UserProfileID,
                                        FirstName = userProfile.FirstName,
                                        Causes = causes.Select(Mapper.Map<Cause, CauseDetailsModel>)
                                    };

                    return View("Projects", model);
                }
            }

            return HttpNotFound( "The person you are looking for could not be found." );
        }