public string DeclineUser([FromBody] ModelHelperAuthorization Id) { if (!ModelState.IsValid) { return(BadRequest(ModelState).ToString()); } //Get user data, and update activated to true ApplicationUser current = UserManager.FindById(Id.Id); current.Activated = "DECLINED"; current.Image = ""; try { IdentityResult result = UserManager.Update(current); try { string subject = "User declined"; string desc = $"Dear {current.Name}, You have been declined as authorized user. You can resend request by uploading picture of document!"; var adminEmail = current.Email; NotifyViaEmail(adminEmail, subject, desc); } catch { } } catch (DbUpdateConcurrencyException) { return(BadRequest().ToString()); } return("Ok"); }
public string AuthorizeUser([FromBody] ModelHelperAuthorization Id) { if (!ModelState.IsValid) { return(BadRequest(ModelState).ToString()); } //Get user data, and update activated to true ApplicationUser current = UserManager.FindById(Id.Id); current.Activated = "ACTIVATED"; try { IdentityResult result = UserManager.Update(current); try { string subject = "Account approval"; string desc = $"Dear {current.Name}, Your account has been approved."; var controllerEmail = current.Email; NotifyViaEmail(controllerEmail, subject, desc); } catch { } } catch (DbUpdateConcurrencyException) { return(BadRequest().ToString()); } return("Ok"); }
public string ResendRequest([FromBody] ModelHelperAuthorization Id) { if (!ModelState.IsValid) { return(BadRequest(ModelState).ToString()); } //var user = new ApplicationUser() { UserName = model.Email, Email = model.Email }; ApplicationUser user = UserManager.FindByEmail(Id.Id); user.Activated = "PENDING"; try { IdentityResult result = UserManager.Update(user); } catch (DbUpdateConcurrencyException) { return(BadRequest().ToString()); } return("Ok"); }