public async Task <IActionResult> List() { var list = new GatePassModel(); var allotedVehicesList = await _vehicleAllotmentService.GetAllAllotedVehiclesAsync(); if (allotedVehicesList != null) { foreach (var item in allotedVehicesList) { var vehicle = await _vehicleMasterService.GetByIdAsync((int)item.VehicleId); var sc = await _userMasterService.GetUserByIdAsync((int)item.Scid); var model = new AllotedVehicleDetailsModel(); model.AllotId = item.Id; model.Model = vehicle.ModelVarient; model.Colour = vehicle.ModelColour; model.VINNumber = vehicle.Vinnumber; model.EngineNumber = vehicle.EngineNumber; model.KeyNo = vehicle.KeyNumber; model.CustomerName = (await _customerService.GetAllCustomerByIdAsync((int)item.CustomerId)).CustomerName; model.SalesConsultant = sc.FirstName + " " + sc.LastName; model.BranchName = (await _branchMasterService.GetBranchByIdAsync((int)item.BranchId)).BranchName; model.AllotDate = Convert.ToDateTime(item.DateCreated).ToString("dd/MM/yyyy"); list.AllotedVehicleDetails.Add(model); } } list.AvaillablePlaces = BindVehicleOutTo(); return(View(list)); }
public async Task <IActionResult> List() { var list = new List <VehicleAllotmentModel>(); var allotedVehicesList = await _vehicleAllotmentService.GetAllAllotedVehiclesAsync(); foreach (var item in allotedVehicesList) { var vehicle = await _vehicleMasterService.GetByIdAsync((int)item.VehicleId); var sc = await _userMasterService.GetUserByIdAsync((int)item.Scid); var model = new VehicleAllotmentModel(); model.Id = item.Id; model.Model = vehicle.ModelVarient; model.Colour = vehicle.ModelColour; model.VINNumber = vehicle.Vinnumber; model.EngineNumber = vehicle.EngineNumber; model.IsAlloted = item.IsAlloted; model.CustomerName = (await _customerService.GetAllCustomerByIdAsync((int)item.CustomerId)).CustomerName; model.SalesConsultant = sc.FirstName + " " + sc.LastName; model.AllotDate = Convert.ToDateTime(item.DateCreated).ToString("dd/MM/yyyy"); model.AgingDays = vehicle.AgingDays; model.BranchName = (await _branchMasterService.GetBranchByIdAsync((int)item.BranchId)).BranchName; list.Add(model); } return(View(list)); }