public async Task<VehicleModel> SearchMPAIP(string splate, string schasis, string sengineNo) { M_PAIP vehicle = new M_PAIP(); VehicleModel vehiclemodel = new VehicleModel(); vehicle = rctpl_db.M_PAIP.Where(r => r.PLATE_NO.Equals(splate) && (r.SERIAL_NO.Equals(schasis) || r.MOTOR_NO.Equals(sengineNo))).FirstOrDefault(); if (vehicle != null) { vehiclemodel.papin = vehicle.PAPIN; vehiclemodel.plateno = vehicle.PLATE_NO; vehiclemodel.chasisno = vehicle.SERIAL_NO; vehiclemodel.engineno = vehicle.MOTOR_NO; vehiclemodel.yearmodel = vehicle.MODEL_YR; vehiclemodel.make = vehicle.MAKE; vehiclemodel.series = vehicle.SERIES; vehiclemodel.color = vehicle.COLOR; vehiclemodel.unladed_weight = vehicle.UN_WEIGHT; vehiclemodel.mvfile = vehicle.MV_FILENO; } else { return null; } return vehiclemodel; }
public async Task<ActionResult> Index(string splate, string schasis, string sengineNo) { VehicleModel data = new VehicleModel(); data = await SearchMPAIP(splate, schasis, sengineNo); if (data != null) { TempData["mypapin"] = data.papin; ViewBag.Success = "Record Found!"; return View(data); } data = await Searchfrom_VehicleDB(splate, schasis, sengineNo); if (data != null) { ViewBag.Success = "Vehicle Record Found!"; return View(data); } ViewBag.Message = "No Record Found!"; return View(); }
public async Task<VehicleModel> Searchfrom_VehicleDB(string splate, string schasis, string sengineNo) { VehicleDetail vehicle = mydb.VehicleDetails.Where(r => r.plateno.Equals(splate) && (r.chassisno.Equals(schasis) || r.engineno.Equals(sengineNo))).FirstOrDefault(); VehicleModel vehiclemodel = new VehicleModel(); if (vehicle != null) { vehiclemodel.papin = "NO PAPIN"; vehiclemodel.plateno = vehicle.plateno; vehiclemodel.chasisno = vehicle.chassisno; vehiclemodel.engineno = vehicle.engineno; vehiclemodel.yearmodel = vehicle.model.ToString(); vehiclemodel.make = vehicle.make; vehiclemodel.series = vehicle.series; vehiclemodel.color = vehicle.color; vehiclemodel.unladed_weight = vehicle.capwt.ToString(); vehiclemodel.mvfile = vehicle.fileno; } else { return null; } return vehiclemodel; }