Example #1
0
        public async Task <ActionResult> AddBilty()
        {
            IVehicleRepository vehiclerepo  = new VehicleRepository();
            Response           vehcleresult = vehiclerepo.GetallSelectListVehicles();


            List <DropDownListModel> list = ((IEnumerable)vehcleresult.Value).Cast <DropDownListModel>().ToList();
            var selectListItemsvehcle     = list.Select(x => new SelectListItem()
            {
                Value = x.Value.ToString(), Text = x.Text
            }).ToList();

            ViewBag.vehcles = selectListItemsvehcle;

            IDriversRepository driverrepo = new DriverRepository();

            Response driverresult = await driverrepo.GetallDrivers();

            List <DriverVM> listDrivers            = ((IEnumerable)driverresult.Value).Cast <DriverVM>().ToList();
            var             selectListItemsDrivers = listDrivers.Select(x => new SelectListItem()
            {
                Value = x.Id.ToString(), Text = x.Name
            }).ToList();

            ViewBag.Drivers = selectListItemsDrivers;


            IPartyRepository partyrepo = new PartyRepository();

            Response partyresult = await partyrepo.GetALLSenderParties();

            List <PartyVM> listparties            = ((IEnumerable)partyresult.Value).Cast <PartyVM>().ToList();
            var            selectListItemsParties = listparties.Select(x => new SelectListItem()
            {
                Value = x.Id.ToString(), Text = x.Party1
            }).ToList();

            ViewBag.Parties = selectListItemsParties;
            BiltyVM bilty = new BiltyVM();

            bilty.Rate = 0;
            //List<> employees = ((IEnumerable)r.Value).Cast<UserVM>().ToList(); ;
            return(View(bilty));
        }