public ActionResult Create(DBhouseRouteVm dBhouseRouteVm)
        {
            if (ModelState.IsValid)
            {
                tbld_distributor_Route tbldDistributorRoute = new tbld_distributor_Route
                {
                    RouteCode     = dBhouseRouteVm.RouteCode,
                    RouteName     = dBhouseRouteVm.RouteName,
                    RouteType     = dBhouseRouteVm.RouteType,
                    CreateDate    = dBhouseRouteVm.CreateDate,
                    ModifiedDate  = dBhouseRouteVm.ModifiedDate,
                    IsActive      = dBhouseRouteVm.IsActive,
                    DistributorID = dBhouseRouteVm.DistributorId,
                    ParentID      = dBhouseRouteVm.ParentId
                };

                Db.tbld_distributor_Route.Add(tbldDistributorRoute);
                Db.SaveChanges();
                TempData["alertbox"]    = "success";
                TempData["alertboxMsg"] = dBhouseRouteVm.RouteName + "  Create Successfully";
                return(RedirectToAction("Create"));
            }
            ViewBag.DBHouse = new SelectList(Db.tbld_distribution_house.Where(x => x.Status == 1).ToList(), "DB_Id", "DBName");
            ViewBag.Type    = new SelectList(Db.tbld_distributor_RouteType.ToList(), "RouteType", "RouteTypeCode");
            ViewBag.status  = new SelectList(Db.status.ToList(), "status_Id", "status_code");
            ViewBag.Parent  = new SelectList(Db.tbld_distributor_Route.Where(x => x.DistributorID == dBhouseRouteVm.DistributorId && x.RouteType == 1).ToList(), "RouteID", "RouteName", dBhouseRouteVm.ParentId);
            return(View(dBhouseRouteVm));
        }
        // GET: DBhouseRoute/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tbld_distributor_Route tbldDistributorRoute = Db.tbld_distributor_Route.Find(id);

            if (tbldDistributorRoute == null)
            {
                return(HttpNotFound());
            }

            DBhouseRouteVm dBhouseRouteVm = new DBhouseRouteVm
            {
                RouteId       = tbldDistributorRoute.RouteID,
                RouteCode     = tbldDistributorRoute.RouteCode,
                RouteName     = tbldDistributorRoute.RouteName,
                RouteType     = tbldDistributorRoute.RouteType,
                CreateDate    = tbldDistributorRoute.CreateDate,
                ModifiedDate  = tbldDistributorRoute.ModifiedDate ?? DateTime.Now,
                IsActive      = tbldDistributorRoute.IsActive,
                DistributorId = tbldDistributorRoute.DistributorID,
                ParentId      = tbldDistributorRoute.ParentID
            };

            ViewBag.DBHouse = new SelectList(Db.tbld_distribution_house.Where(x => x.Status == 1).ToList(), "DB_Id", "DBName");
            ViewBag.Type    = new SelectList(Db.tbld_distributor_RouteType.ToList(), "RouteType", "RouteTypeCode");
            ViewBag.status  = new SelectList(Db.status.ToList(), "status_Id", "status_code");
            ViewBag.Parent  = new SelectList(Db.tbld_distributor_Route.Where(x => x.DistributorID == dBhouseRouteVm.DistributorId && x.RouteType == 1).ToList(), "RouteID", "RouteName", dBhouseRouteVm.ParentId);
            return(View(dBhouseRouteVm));
        }
        // GET: DBhouseRoute/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tbld_distributor_Route tbldDistributorRoute = Db.tbld_distributor_Route.Find(id);

            if (tbldDistributorRoute == null)
            {
                return(HttpNotFound());
            }
            return(View(tbldDistributorRoute));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            tbld_distributor_Route tbldDistributorRoute = Db.tbld_distributor_Route.Find(id);

            if (tbldDistributorRoute != null)
            {
                Db.tbld_distributor_Route.Remove(tbldDistributorRoute);
            }
            Db.SaveChanges();
            TempData["alertbox"] = "error";
            if (tbldDistributorRoute != null)
            {
                TempData["alertboxMsg"] = tbldDistributorRoute.RouteName + "Delete Successfully";
            }
            return(RedirectToAction("Index"));
        }