public void GetProfileById_ReturnsAProfileWithAValidId_Test()
        {
            Guid    expected = Guid.Parse("d2524eca-69b9-4b95-be25-019beffeb22a");
            Profile actual   = target.GetProfileById(expected);

            Assert.AreEqual(expected, actual.Id);
        }
        public ActionResult Detail(Guid id)
        {
            ViewData["AuthUserGuid"] = Request.ServerVariables.Get("AUTH_USER");
            ProfileModel profile = ProfilesRepository.GetProfileById(id).AsProfileModel();

            profile.RouteList = RoutesRepository.GetUsersRoutes(id).AsRouteModelList();
            return(View(profile));
        }
Exemplo n.º 3
0
        internal object GetProfileById(string profileId)
        {
            Profile foundProfile = _repo.GetProfileById(profileId);

            if (foundProfile == null)
            {
                throw new Exception("Profile does not exist");
            }
            return(foundProfile);
        }
Exemplo n.º 4
0
        internal Profile GetProfileById(int id, string userId)
        {
            Profile foundProfile = _repo.GetProfileById(id);

            if (foundProfile == null)
            {
                throw new Exception("This profile does not exist.");
            }
            if (foundProfile.UserId != userId)
            {
                throw new Exception("This profile does not belong to you.");
            }
            return(foundProfile);
        }