Exemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Inv_Orders inv_orders = db.Inv_Orders.Find(id);

            db.Inv_Orders.Remove(inv_orders);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
 public ActionResult Edit([Bind(Include = "Inv_OrdersId,Inv_CustomerId,OrderDate,OrderDetails,TotalUnit,TotalPrice,Paid,Due,DiscountPercent,DiscountAmount,Adjustment,UnitofMeasurementCode,Note,CreatedDate,UpdateDate,IsActive,IsDeleted,CompanyId,UserId")] Inv_Orders inv_orders)
 {
     if (ModelState.IsValid)
     {
         db.Entry(inv_orders).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Inv_CustomerId = new SelectList(db.Inv_Customer, "Inv_CustomerId", "CustomerName", inv_orders.Inv_CustomerId);
     return(View(inv_orders));
 }
Exemplo n.º 3
0
        // GET: /Orders/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Inv_Orders inv_orders = db.Inv_Orders.Find(id);

            if (inv_orders == null)
            {
                return(HttpNotFound());
            }
            return(View(inv_orders));
        }
Exemplo n.º 4
0
        // GET: /Orders/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Inv_Orders inv_orders = db.Inv_Orders.Find(id);

            if (inv_orders == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Inv_CustomerId = new SelectList(db.Inv_Customer, "Inv_CustomerId", "CustomerName", inv_orders.Inv_CustomerId);
            return(View(inv_orders));
        }
        // GET: /SaleMain/SellProduct
        public ActionResult SellProduct(SaleMainVM aProduct)
        {
            try
            {
                Inv_Orders aOrders = new Inv_Orders
                {
                    OrderDate       = aProduct.OrderDate,
                    TotalPrice      = aProduct.TotalPrice,
                    Paid            = aProduct.Paid,
                    Due             = aProduct.Due,
                    DiscountAmount  = aProduct.DiscountAmount,
                    DiscountPercent = aProduct.DiscountPercent,
                    Adjustment      = aProduct.Adjustment,
                    TotalUnit       = aProduct.TotalUnit,
                    CreatedDate     = aProduct.CreatedDate,
                    UpdateDate      = aProduct.UpdateDate,

                    IsActive  = aProduct.IsActive,
                    IsDeleted = aProduct.IsDeleted,
                    UserId    = aProduct.UserId
                };
                var save = db.Inv_Orders.Add(aOrders);
                //db.SaveChanges();


                foreach (var aOP in aProduct.OrderProducts)
                {
                    Inv_OrderProduct aInvOrderProduct = new Inv_OrderProduct
                    {
                        Inv_OrdersId  = aOrders.Inv_OrdersId,
                        Inv_ProductId = aOP.Inv_ProductId,
                        CreatedDate   = aProduct.CreatedDate,
                        UpdateDate    = aProduct.UpdateDate,

                        IsActive  = aProduct.IsActive,
                        IsDeleted = aProduct.IsDeleted,
                        UserId    = aProduct.UserId
                    };
                    db.Inv_OrderProduct.Add(aInvOrderProduct);
                }
                db.SaveChanges();
                return(View());
            }
            catch (Exception ex)
            {
                throw;
            }
        }