public ActionResult OwnerLoginView(OwnerAccount loginAccount) { if (ModelState.IsValid) { try { OwnerAccount account = ownerRepository.GetAnOwnerEmailPass(loginAccount.UserEmail, loginAccount.UserPassword); if (account != null) { var artClaim = new List <Claim>() { new Claim(ClaimTypes.Name, account.FirstName), new Claim(ClaimTypes.Email, account.UserEmail), }; var artIdentity = new ClaimsIdentity(artClaim, "Art Identity"); var userPrinciple = new ClaimsPrincipal(new[] { artIdentity }); HttpContext.SignInAsync(userPrinciple); return(GoToMainOwnerView(account.Id)); } } catch (Exception ex) { //Add error ViewBag.Message = ex; return(View()); } } ViewBag.Message = "Missing or Incorrect Data"; return(View()); }
public ActionResult AddOwnerView(ViewModelData viewModelData) { if (ModelState.IsValid) { try { OwnerAccount newAccount = viewModelData.owner; if (!ownerRepository.CheckOwner(newAccount)) { ownerRepository.Add(newAccount); return(GoToMainOwnerView(newAccount.Id)); } } catch (Exception ex) { //Add error ViewBag.Message = ex; return(View(viewModelData)); } } ViewBag.Message = "Missing or Incorrect Data"; return(View(viewModelData)); }
public ActionResult Owner([Bind(Prefix = "Item")] OwnerAccount model) { IMessageProvider msg = null; if (ModelState.IsValid(model)) { this.ModelState.Clear(); msg = model.Save(); } model.Ready(); return(View(new EcardModelItem <OwnerAccount>(model, msg))); }