public void ExitFromAccount() { var directory = new DirectoryForJson <UserSignInDTO>(UserSignInDTO.Login, UserSignInDTO, false); directory.WriteInDerictory(); if (UserSignInDTO.Rank == "User") { IsLogin = false; } else if (UserSignInDTO.Rank == "Admin") { IsLoginSuperUser = false; } }
public SignInModel(string login, string password) { if (Directory.Exists(login)) { ValidationUser validation = new ValidationUser(login, password, DirectoryForJson <UserDTO> .ReadJson(login + "\\" + login + ".json")); validation.CheckExistUser(); Login = login; Password = password; } else { throw new ValidationException("Такого пользователя не существует.", ""); } }
public SignInModel(string login, string password) { if (Directory.Exists(login)) { ValidationUser validation = new ValidationUser(login, password, DirectoryForJson <UserSignInDTO> .ReadJson(login + "\\" + login + ".json")); validation.CheckExistUser(); Rank = "User"; } else if (login == "admin" && password == "admin") { Rank = "Admin"; } Login = login; Password = password; }
public UserDTO GetRecords() { return(DirectoryForJson <UserDTO> .ReadJson(login + "\\" + login + ".json")); }
public void CreateRecord() { var directory = new DirectoryForJson <UserDTO>(User.Login, User, false); directory.WriteInDerictory(); }
public UserSignInDTO GetUser(int id) { return(DirectoryForJson <UserSignInDTO> .ReadJson(Users[id - 1] + "\\" + Users[id - 1] + ".json")); }