public ActionResult Create(Inspection inspection) { inspection.Amount = 50; inspection.Week = commonUtility. GetWeekNumber(inspection.InspectionDate); var data = inspectionUtility. FilterByPlateNumber(inspection.InspectionDate.Year, inspection.Week, inspection.Truck.PlateNumber); if (data.Count() == 0) { if (ModelState.IsValid) { inspectionRepository.Add(inspection); return(RedirectToAction("Index", "Inspection")); } } else { TempData["Message"] = "Please try with another Plate , because this truck has already inspection for this week"; return(RedirectToAction("Messages", "Inspection")); } return(View(inspection)); }