Пример #1
0
        public ActionResult Details(string id)
        {
            User user = _repository.GetUser(id);

            if (user == null)
            {
                return(RedirectToAction("Index"));
            }

            return(View("Details", user));
        }
Пример #2
0
        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);
        }
Пример #3
0
 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!");
     }
 }
Пример #4
0
        // 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);
        }
Пример #5
0
        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;
            }
        }
Пример #6
0
        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);
            }
        }
Пример #7
0
 public User GetUser(string email)
 {
     return(userDB.GetUser("email", email));
 }