예제 #1
0
        public ActionResult Receipt(int id)
        {
            Models.CustomerOrder customerOrder = Miscellaneous.HabibDataClass.Habib.CustomerOrders.Find(id);

            List <Models.ShoeSizeColor_CustomerOrder> l = customerOrder.ShoeSizeColor_CustomerOrder.ToList();

            View_Modals.posReciptModel posModel = new View_Modals.posReciptModel(customerOrder, l);
            return(View(posModel));
        }
예제 #2
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            CustomerOrder = await _context.CustomerOrder.SingleOrDefaultAsync(m => m.ID == id);

            if (CustomerOrder == null)
            {
                return(NotFound());
            }
            return(Page());
        }
예제 #3
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            CustomerOrder = await _context.CustomerOrder.FindAsync(id);

            if (CustomerOrder != null)
            {
                _context.CustomerOrder.Remove(CustomerOrder);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
예제 #4
0
        public ActionResult checkout(string[] articles, string[] sizes, string[] colors, string[] quantity, string total)
        {
            Models.CustomerOrder customerOrder = new Models.CustomerOrder()
            {
                customerName = "",
                dateOfOrder  = DateTime.Now,

                discount      = 0,
                employee_Id   = 1009,
                finalAmount   = int.Parse(total),
                totalAmount   = int.Parse(total),
                deleteRemarks = "a"
            };

            Miscellaneous.HabibDataClass.Habib.CustomerOrders.Add(customerOrder);
            Miscellaneous.HabibDataClass.Habib.SaveChanges();

            int id = Miscellaneous.HabibDataClass.Habib.CustomerOrders.ToList().Last().customerOrder_Id;
            List <Models.ShoeSizeColor_CustomerOrder> l = new List <Models.ShoeSizeColor_CustomerOrder>();

            for (int i = 0; i < articles.Length; i++)
            {
                var temp1 = articles[i];
                var temp2 = int.Parse(sizes[i]);

                var temp3 = colors[i];
                var temp4 = quantity[i];
                l.Add(new Models.ShoeSizeColor_CustomerOrder()
                {
                    batch_Id         = 30,
                    customerOrder_Id = id,
                    price            = Miscellaneous.HabibDataClass.Habib.Shoes.Where(c => c.shoeArticle.Equals(temp1)).First().shoePrice,
                    quantity         = int.Parse(temp4),
                    shoeSizeColor_Id = Miscellaneous.HabibDataClass.Habib.Shoe_Size_Color.Where(c => c.Shoe_Size.Shoe.shoeArticle.Equals(temp1) && c.Shoe_Size.Size.sizeNo == temp2 && c.Color.colorName.Equals(temp3)).First().shoeSizeColor_Id
                });
            }

            Miscellaneous.HabibDataClass.Habib.ShoeSizeColor_CustomerOrder.AddRange(l);
            Miscellaneous.HabibDataClass.Habib.SaveChanges();

            return(Json(new { newURL = Url.Action("Receipt", "PointOfSale", new { id = id }) }, JsonRequestBehavior.AllowGet));
        }