Example #1
0
        public IActionResult ValidateSignUp(IFormCollection collection, Models.PuserModel userModel)
        {
            Domain.Model.Plocation location = new Domain.Model.Plocation();
            Domain.Model.Puser     user     = new Domain.Model.Puser();

            try
            {
                location.Street  = userModel.Street;
                location.City    = userModel.City;
                location.PState  = userModel.State;
                location.Zipcode = userModel.Zipcode;

                repository.InsertLocation(location);

                List <Domain.Model.Plocation> locations = repository.GetLocations();

                user.Firstname  = userModel.Firstname;
                user.Lastname   = userModel.Lastname;
                user.Username   = userModel.Username;
                user.pPassword  = userModel.PPassword;
                user.Email      = userModel.Email;
                user.LocationId = locations [locations.Count - 1].LocationId;

                repository.AddUser(user);

                return(RedirectToAction(nameof(Login)));
            }
            catch (Exception e)
            {
                return(View());
            }
        }
Example #2
0
        public IActionResult Order(int pizzaId)
        {
            Domain.Model.Pizza     pizza    = repository.GetPizza(1);
            Domain.Model.Plocation location = repository.GetLocation(pizza.SLocationId);

            if (pizza != null)
            {
                orderModel = new PorderModel();


                orderModel.PDate       = DateTime.Now.ToString("M/d/yyyy");
                orderModel.PTime       = DateTime.Now.ToShortTimeString();
                orderModel.PType       = pizza.PType;
                orderModel.PSize       = pizza.PSize;
                orderModel.Crust       = pizza.Crust;
                orderModel.PUserId     = Convert.ToInt32(TempData["user"]);
                orderModel.PizzaId     = pizza.PizzaId;
                orderModel.OrderCost   = "57.67";
                orderModel.PPrice      = pizza.PPrice;
                orderModel.CLocationId = location.LocationId;
                orderModel.Street      = location.Street;
                orderModel.City        = location.City;
                orderModel.PState      = location.PState;
                orderModel.Zipcode     = location.Zipcode;

                return(View(orderModel));
            }

            return(View());
        }