Пример #1
0
        public async Task <IActionResult> Create(Profile profile)
        {
            if (!ModelState.IsValid)
            {
                return(View("EditProfile", profile));
            }
            var createdProfile = await ProfileService.Connect(SharedDataConnection).Create(profile);

            return(RedirectToAction("ViewProfile", new { id = createdProfile.Id }));
        }
Пример #2
0
        public async Task <IActionResult> ViewProfile(string id)
        {
            var userId    = User.FindFirst(ClaimTypes.NameIdentifier).Value;
            var myProfile = await ProfileService.Connect(SharedDataConnection).ReadAsync(id);

            if (myProfile == null)
            {
                return(RedirectToAction("Create"));
            }
            return(View(myProfile));
        }
Пример #3
0
        public async Task <IActionResult> Index()
        {
            var userId    = User.FindFirst(ClaimTypes.NameIdentifier).Value;
            var myProfile = await ProfileService.Connect(SharedDataConnection).FindByUserId(userId);

            if (myProfile == null)
            {
                return(RedirectToAction("Create"));
            }
            return(RedirectToAction("ViewProfile", new { id = myProfile.Id }));

            return(View("ViewProfile", myProfile));
        }
Пример #4
0
        public IActionResult Create()
        {
            var myProfile = ProfileService.Connect(SharedDataConnection).StubForUser(User);

            return(View("EditProfile", myProfile));
        }