public ActionResult Create([Bind(Include = "TrucksKey,RegistrationNo,TruckStatus,TruckPrice")] Trucks trucks) { if (ModelState.IsValid) { if (trucks.TruckRegChecker() == true) { ViewBag.message = "The Truck has already Exist!!!"; return(View(trucks)); } else { db.trucks.Add(trucks); db.SaveChanges(); return(RedirectToAction("Index")); } } return(View(trucks)); }