public ActionResult LoadNewGarageInfo(Guid id, Guid?garageInfoId = null, Guid?category = null) { Guid garageInfoid = garageInfoId.GetValueOrDefault(); Model.GarageInfo FGarageDetails = fleetservice.GetGarageInfoById(garageInfoid); var model = garageInfoId == null ? new GarageInfo() : FGarageDetails; model.Currencies = new SelectList(orService.GetCurrencies(), "Id", "ShortName"); model.Suppliers = new SelectList(poService.GetSuppliers(), "Id", "Name"); model.MileageCategory = new SelectList(fleetservice.GetCheckListCategory(), "Id", "Name"); model.FleetId = id; if (category != null) { model.ChecKListCatId = category; } if (FGarageDetails != null) { CheckListCategory CListCat = fleetservice.GetCheckListCatByGarageInfo(FGarageDetails); model.ChecKListCatId = CListCat != null ? CListCat.Id : (Guid?)null; } ViewBag.Action = garageInfoId == null ? "SaveNewGarageInfo" : "EditGarageInfo"; return(View("LoadNewGarageInfo", model)); }
public Model.CheckListCategory GetCheckListCatByGarageInfo(Model.GarageInfo Entity) { float serviceCatgory = (float)(Entity.IfServiceNextMilleage - Entity.IfServiceCurrentMilleage); return SessionData.CurrentSession.CheckListCategoryList.FirstOrDefault(p => p.Name == serviceCatgory); }