public ActionResult Add(SalesOrderKonsolidasi model, string btnsave)
        {
            if (ModelState.IsValid)
            {
                //cek min max
                bool isPalid = true;
                Context.DaftarHargaKonsolidasi     dbDh     = RepoDHKonsolidasi.FindByItemId(model.RuteId.Value);
                Context.DaftarHargaKonsolidasiItem dbDhItem = dbDh.DaftarHargaKonsolidasiItem.Where(d => d.Id == model.RuteId.Value).FirstOrDefault();
                if (!isPalid)
                {
                    return(View("Form", model));
                }

                Context.SalesOrder            dbso   = new Context.SalesOrder();
                Context.SalesOrderKonsolidasi dbitem = new Context.SalesOrderKonsolidasi();
                model.setDb(dbitem);
                dbitem.Urutan              = RepoSalesOrder.getUrutanKonsolidasi(model.TanggalMasuk.Value) + 1;
                dbitem.SONumber            = RepoSalesOrder.generateKonsolidasi(model.TanggalMasuk.Value, dbitem.Urutan);
                dbitem.DN                  = "DN" + dbitem.SONumber;
                dbso.SalesOrderKonsolidasi = dbitem;

                if (btnsave == "save")
                {
                    dbso.Status = "save";
                }
                else if (btnsave == "draft")
                {
                    dbso.Status = "draft";
                }
                else
                {
                    dbso.Status = model.Status;
                }

                RepoSalesOrder.save(dbso);

                return(RedirectToAction("Index"));
            }
            return(View("Form", model));
        }