Ejemplo n.º 1
0
        public async Task <ActionResult> Sale(Logica.Models.BindingModels.SalesMethodPaymentBindingModel model)
        {
            ApplicationUser user = await UserManager.FindByNameAsync(User.Identity.Name);

            var productsDetailsViewModel = (Logica.Models.ViewModels.ProductsDetailsViewModel)Session["product"];

            ViewBag.Product = productsDetailsViewModel;

            Logica.BL.Customer customer  = new Logica.BL.Customer();
            var customerDetailsViewModel = (from q in customer.GetCustomer(user.Id)
                                            select new Logica.Models.ViewModels.CustomerDetailsViewModel
            {
                Address = q.Address
            }).FirstOrDefault();

            var methodPaymentId = model.MethodPaymentId;

            Logica.BL.Sale sale = new Logica.BL.Sale();
            var            id   = sale.CreateSale(methodPaymentId,
                                                  productsDetailsViewModel.Price.Value,
                                                  customerDetailsViewModel.Id);

            ViewBag.Id = id;

            sale.CreateSaleDetails(id,
                                   productsDetailsViewModel.Id,
                                   1,
                                   productsDetailsViewModel.Price.Value);

            Session.Remove("product");

            return(View());
        }
Ejemplo n.º 2
0
        // GET: Sales
        public async Task <ActionResult> ShippingCost()
        {
            ApplicationUser user = await UserManager.FindByNameAsync(User.Identity.Name);

            var productsDetailsViewModel = (Logica.Models.ViewModels.ProductsDetailsViewModel)Session["product"];

            Logica.BL.Customer customer  = new Logica.BL.Customer();
            var customerDetailsViewModel = (from q in customer.GetCustomer(user.Id)
                                            select new Logica.Models.ViewModels.CustomerDetailsViewModel
            {
                Address = q.Address
            }).FirstOrDefault();

            ViewBag.Product  = productsDetailsViewModel;
            ViewBag.Customer = customerDetailsViewModel;

            return(View());
        }