public ActionResult NewBuilty(int id = 0, int companyid = 0)
        {
            Builty editBuilty = new Builty();

            BuiltyCRuDViewModel EditBuilty = new BuiltyCRuDViewModel();

            //Callthis Method from VehicleCRudView
            var viewmodel = new BuiltyViewModel();

            if (id != 0)
            {
                editBuilty = EditBuilty.editbuilty(id, companyid);

                /*   viewmodel = new BuiltyViewModel()
                 * {
                 *     Vehicles = vehicles,
                 *     Drivers = drivers,
                 *     builty=editBuilty
                 *
                 * };*/
            }
            var GoodsDetailList = EditBuilty.GoodsDetailList();

            editBuilty.BuiltyDetailList = GoodsDetailList;

            return(View(editBuilty));
        }
        public ActionResult BuiltyDetail(int id = 0, int companyid = 0)
        {
            BuiltyCRuDViewModel BuiltyDetail = new BuiltyCRuDViewModel();

            Builty builtydetail = BuiltyDetail.editbuilty(id, companyid);

            return(View(builtydetail));
        }
        public ActionResult NewBuilty(Builty builty)
        {
            var    ReportData = new DataSet();
            string message    = "";
            BuiltyCRuDViewModel builtycrud = new BuiltyCRuDViewModel();
            var viewmodel = new BuiltyViewModel();

            ModelState["BuiltyDetail"].Errors.Clear();
            if (ModelState.IsValid)
            {
                if (builty.BuiltyId == 0)
                {
                    try
                    {
                        ReportData = builtycrud.Builty(builty);
                        if (ReportData.Tables[0].Rows.Count != 0)
                        {
                            TempData["ReportData"] = ReportData;
                            TempData.Keep();
                            return(RedirectToAction("GenerateBuilty", "Admin"));
                        }
                    }
                    catch (Exception e)
                    {
                        message = e.Message;
                    }

//                    return RedirectToAction("builtyhome", "Admin", new { livecompanyid = Session["user_Id"] });
                }
                else
                {
                    try
                    {
                        ReportData = builtycrud.BuiltyUpdate(builty);

                        if (ReportData.Tables[0].Rows.Count != 0)
                        {
                            TempData["ReportData"] = ReportData;
                            TempData.Keep();
                            return(RedirectToAction("GenerateBuilty", "Admin"));
                        }
                    }
                    catch (Exception e)
                    {
                        message = e.Message;
                    }

                    /*    if (message != "")
                     *  {
                     *      TempData["message"] = "Builty update sucessfully";
                     *      TempData.Keep();
                     *      return RedirectToAction("builtyhome", "Admin", new { livecompanyid = Session["user_Id"] });
                     *  }
                     *  else
                     *  {*/

                    //        return RedirectToAction("builtyhome", "Admin", new { livecompanyid = Session["user_Id"] });
                }
            }
            TempData["GenerateBuiltyMessage"] = message;

            /*          viewmodel = new BuiltyViewModel()
             *        {
             *            builty = builty
             *        };
             */
            var GoodsDetailList = builtycrud.GoodsDetailList();

            builty.BuiltyDetailList = GoodsDetailList;
            return(View(builty));
        }