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 })); }
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)); }
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)); }
public IActionResult Create() { var myProfile = ProfileService.Connect(SharedDataConnection).StubForUser(User); return(View("EditProfile", myProfile)); }