public ActionResult Create()
 {
     ViewBag.itypes = InvoiceType.get();
     ViewBag.loc    = Location.GetLocations();
     ViewBag.party  = party.Getparties();
     ViewBag.items  = Item.Get();
     return(View());
 }
 public ActionResult Edit([Form] SalesInvoice s1)
 {
     if (ModelState.IsValid)
     {
         s1.Update();
         return(RedirectToAction("Index"));
     }
     else
     {
         ViewBag.itypes = InvoiceType.get();
         ViewBag.loc    = Location.GetLocations();
         ViewBag.party  = party.Getparties();
         ViewBag.items  = Item.Get();
         return(View(SalesInvoice.GetSaleInvoice(s1.SaleInvoiceId)));
     }
     //return View();
 }
        public async Task <ActionResult> Create([Form] SalesInvoice s1)
        {
            if (ModelState.IsValid)
            {
                await Task.Run(() =>
                {
                    s1.Create();
                });

                return(RedirectToAction("Create"));
            }
            else
            {
                ViewBag.itypes = InvoiceType.get();
                ViewBag.loc    = Location.GetLocations();
                ViewBag.party  = party.Getparties();
                ViewBag.items  = Item.Get();
                return(View(s1));
            }
        }
        public async Task <ActionResult> Edit(int?id)
        {
            if (!id.HasValue)
            {
                return(RedirectToAction("Index"));
            }
            SalesInvoice temp = null;

            ViewBag.id = id.Value;
            await Task.Run(() =>
            {
                ViewBag.itypes = InvoiceType.get();
                ViewBag.loc    = Location.GetLocations();
                ViewBag.party  = party.Getparties();
                ViewBag.items  = Item.Get();

                temp = SalesInvoice.GetSaleInvoice(id.Value);
            });

            return(View(temp));
        }
        public ActionResult TypeEdit(int id)
        {
            var x = InvoiceType.get(id);

            return(Json(Newtonsoft.Json.JsonConvert.SerializeObject(x.Tables[0]), JsonRequestBehavior.AllowGet));
        }
 // GET: Invoice
 public ActionResult Types()
 {
     ViewBag.data = InvoiceType.get();
     return(View());
 }