public ActionResult Details(string id) { User user = _repository.GetUser(id); if (user == null) { return(RedirectToAction("Index")); } return(View("Details", user)); }
public void ModifyUser(int id, string email, string name, string phone, string address, string zipcode, string age) { User user = userDb.GetUser(id); user.Email = email; user.Name = name; user.Phone = phone; user.Address = address; user.Zipcode = zipcode; user.Age = age; userDb.ModifyUser(user); }
public void SetUp() { acc = new Account(); userLogic = new UserLogic(connectionString); userDB = new UserDB(connectionString); user = userDB.GetUser("email", "*****@*****.**"); if (user.ID < 1) { userLogic.CreateUserWithPassword("Rune", "G", "G-Street", 9000, "G-Borg", "*****@*****.**", 81238123, "SuperTester123!"); } }
// Validates an users attempt to login. Returns true if password matches with the email // and returns false otherwise. public User ValidatePassword(string email, string password) { User user = userDB.GetUser("email", email); if (user.ErrorMessage == "") { if (!account.ValidateLogin(user.Salt, user.HashPassword, password)) { user.ErrorMessage = "Forkert email eller kodeord"; } } return(user); }
public void CreateAd(string title, string description, double price, DateTime startDate, DateTime endDate, int?bikeId, int?userId) { var b = _bikeDb.Find(bikeId); var u = _userDb.GetUser(userId); try { if (b != null && u != null) { if (price >= 0 && startDate >= DateTime.Now.Date && endDate >= startDate) { var advertisment = new Advertisement { Title = title, Description = description, Price = price, StartDate = startDate, EndDate = endDate, BikeId = bikeId, UserID = userId, }; _adDb.AddAd(advertisment); } else { throw new FaultException("Please check if your given information is correct"); } } else { throw new FaultException("No user and/or bicycle was found"); } } catch (Exception) { throw; } }
protected async void OnLoginButtonClicked(object sender, EventArgs e) { await mUserService.RefreshDataAsync(); User one = (User)BindingContext; User user = await mUserService.GetUser(one.Name, one.Password, one.Type); if (user != null) { //Console.WriteLine("Get User"); // Init the current user ID GlobalManager.Instance.CurrentUser = user; // Init the friends mUserService.InitFriends(); // Pop messagelist await mMessageService.RefreshDataAsync(user.ID); var messageListPage = new MessageListPage(); await Navigation.PushAsync(messageListPage); } }
public User GetUser(string email) { return(userDB.GetUser("email", email)); }