//Autentikasi grosir private UserModel AuthenticateGrosir(Grosir login) { UserModel user = null; RepoUser repo = new RepoUser(); try { Grosir temp = repo.GetGrosir(login.Email, login.Password); user = new UserModel { Name = temp.NamaGrosir, Time = DateTime.Now }; return(user); } catch (Exception) { return(user); } }
//Autentikasi admin private UserModel Authenticate(Admin login) { UserModel user = null; RepoUser repo = new RepoUser(); try { Admin temp = repo.GetUser(login.Username, login.Password); user = new UserModel { Name = temp.Username, Time = DateTime.Now }; return(user); } catch (Exception) { return(user); } }
internal static async Task <ResponseGetUsers> GetAll() { RepoUser repoUser = new RepoUser(); IBaseResponse response; try { response = await Task.FromResult(repoUser.GetAll()).Result; } catch (Exception) { throw; } finally { repoUser = null; } return(response as ResponseGetUsers); }
internal static async Task <ResponseAddUser> Add(User user) { RepoUser repoUser = new RepoUser(); IBaseResponse response; try { response = await Task.FromResult(repoUser.Add(user)).Result; } catch (Exception) { throw; } finally { repoUser = null; } return(response as ResponseAddUser); }