Пример #1
0
 public LocationTest()
 {
     address     = new Address("1123 Fletcher St", "Tampa", "Florida");
     sut         = new lo.Location(address);
     userAddress = new Address("51 Viking Oak", "Tampa", "Florida");
     user        = new us.User("admin", "password", userAddress);
 }
Пример #2
0
        public UserTest()
        {
            address     = new Address("1123 Fletcher St", "Tampa", "Florida");
            userAddress = new Address("51 Viking Oak", "Tampa", "Florida");

            sut      = new us.User("admin", "password", userAddress);
            location = new lo.Location(address);

            sut.CreateOrder(location.OrderNumber, location.Address);
        }
Пример #3
0
        /*
         * public static List<ord.Order> GetOrderByUser(us.User user)
         * {
         *  var dataUser = _db.User.Where(u => u.UserId == user.UserId).FirstOrDefault();
         *
         *  if (dataUser == null)
         *  {
         *      return null;
         *  }
         *
         *  return OrderHelper.GetOrders(dataUser.Order);
         * }
         */

        public static us.User GetUser(us.User user)
        {
            var dataUser = _db.User.Where(u => u.Username == user.Username).FirstOrDefault();

            if (dataUser == null ||
                dataUser.Password != user.Password)
            {
                return(null);
            }

            return(user);
        }
Пример #4
0
        public OrderTest()
        {
            address     = new Address("1123 Fletcher St", "Tampa", "Florida");
            userAddress = new Address("51 Viking Oak", "Tampa", "Florida");

            location = new lo.Location(address);
            user     = new us.User("admin", "password", userAddress);
            sut      = new ord.Order(user.Username, location.OrderNumber, location.Address);

            crust   = new pi.Crust();
            size    = new pi.Size();
            topping = new pi.Toppings();
        }
Пример #5
0
        public static bool SetUser(us.User user)
        {
            var dataUser = new User()
            {
                Username  = user.Username,
                Password  = user.Password,
                AddressId = 1
            };

            _db.User.Add(dataUser);


            return(_db.SaveChanges() == 1);
        }