public string LogIn(Login loginData) { string status = "Ok"; var user = userRepositories.FindUserByLogin(loginData.LoginName); if (user == null) { return("Errore"); } return(status); }
public int CreateChat(Chat newChat, string loginCreator) { var idCreated = 0; if (newChat != null && loginCreator != null) { var creator = userRepositories.FindUserByLogin(loginCreator); newChat.CreatorID = creator.Id; newChat.Users = creator.Id.ToString(); ChatRepositiries.AddNewChat(newChat); var chats = ChatRepositiries.GetChats(creator.Id) as List <Chat>; idCreated = chats[chats.Count - 1].ID; } return(idCreated); }
public void CreateMessage(Message newMessage, string userName) { var user = userRepositories.FindUserByLogin(userName); newMessage.UserName = user.FirstName; newMessage.PablishingData = DateTime.UtcNow; messageRepositories.AddMessage(newMessage); }
public User GetUser(string login) { var user = userRepositories.FindUserByLogin(login); return(user); }