public IActionResult CreateProfile(Clients_Profile clients_Profile) { var check = _db.Clients_Profile.Find(_userManager.GetUserId(User)); if (_signInManager.IsSignedIn(User)) { if (check == null) { clients_Profile.Id = _userManager.GetUserId(User); _db.Clients_Profile.Add(clients_Profile); _db.SaveChanges(); //Search for an existing profile and update it var search = _db.User_Profile_Controller.Find(_userManager.GetUserId(User)); if (search != null) { search.Profile_Activated = "2"; //Profile Activated codes 1(Fully Activated) 2(Pending to be Activated by Admin) 0(Disactivated) search.Account_Activated = "1"; //Account_Activated codes 1(Fully Activated) 0(Disactivated) _db.SaveChanges(); } return(RedirectToAction("Index", "Client")); } else { return(RedirectToAction("Index", "Client")); } } else { return(RedirectToAction("Index", "Client")); } }
public IActionResult UpdateProfile(Clients_Profile model) { var search = _db.Clients_Profile.Find(_userManager.GetUserId(User)); if (search != null) { search.Email = model.Email; search.Phone_Number = model.Phone_Number; _db.SaveChanges(); } return(RedirectToAction(nameof(Index))); }