public ActionResult <BasicReturn> Send(Key data) { BasicReturn _return = new BasicReturn(); try { Key key = new Key(data.Email, Convert.ToInt32(_user), Convert.ToInt32(_user), data.BlockResult); string guid = _sendKey.SendKey(key); EmailMessageModels.Content content = EmailMessageModels.SendKey(guid, _configuration.GetValue <string>("domain")); int messageId = _email.CreateEmail("New User", data.Email, Convert.ToInt32(_user), content); _queue.SaveMessage("email", messageId.ToString()); _return.Success = true; return(_return); } catch (System.Exception ex) { _return.Success = false; _return.Message = ex.Message; return(_return); } }
public ActionResult <BasicReturn> ChangeName(User user) { BasicReturn _return = new BasicReturn(); try { int _userID = Convert.ToInt32(User.FindFirst(claim => claim.Type == "UserID")?.Value); string _url = _httpContextAccessor.HttpContext.Request.Host + _httpContextAccessor.HttpContext.Request.Path; _myIdentity.ChangeName(_userID, user.Name, user.Password, _url); EmailMessageModels.Content content = EmailMessageModels.ChangeName(_user.Name); int messageId = _email.CreateEmail(_user.Name, _user.Email, _user.Id, content); _queue.SaveMessage("email", messageId.ToString()); _return.Success = true; } catch (SqlException ex) { _return.Success = false; _return.Message = ex.Message; _return.Code = ex.Number.ToString(); return(_return); } catch (System.Exception ex) { _return.Success = false; _return.Message = ex.Message; return(_return); } return(_return); }
public ActionResult <BasicReturn> PhoneNumber(string phone) { BasicReturn _return = new BasicReturn(); try { EmailMessageModels.Content content = EmailMessageModels.RequestKeys(phone, _name, _email); int messageId = _dataEmail.CreateEmail("Carlos", "*****@*****.**", Convert.ToInt32(_user), content); _queue.SaveMessage("email", messageId.ToString()); _return.Success = true; return(_return); } catch (System.Exception ex) { _return.Success = false; _return.Message = ex.Message; _return.Details = ex.StackTrace; return(_return); } }