public IActionResult GetHomePage() { var tagline = ApiGetHomePageInfo(); var homepageBindingModel = new HomePageBindingModel(); if (tagline != null) { homepageBindingModel.Tagline = tagline.TagLine; var result = new ObjectResult(homepageBindingModel); return(result); } else if (tagline == null) { homepageBindingModel.Tagline = "Default Tagline - Change me"; var homepage = new HomePage { TagLine = homepageBindingModel.Tagline }; _context.HomePage.Add(homepage); _context.SaveChanges(); var result = new ObjectResult(homepageBindingModel); return(result); } return(NotFound()); }
public async Task <IActionResult> HomePageLogin([FromBody] HomePageBindingModel homePageViewModel, string returnUrl) { if (ModelState.IsValid) { IdentityUser user = await userManger.FindByNameAsync(homePageViewModel.SearchUsername); if (user != null) { await signInManager.SignOutAsync(); if ((await signInManager.PasswordSignInAsync(user, homePageViewModel.SearchPassword, false, false)).Succeeded) { return(Ok(user)); } else { return(Unauthorized()); } } } return(Unauthorized()); }