public int SaveCarDiamention(CarDiamention model) { using (IDbConnection connection = OpenConnection(dataConnection)) { string sql = @"INSERT INTO CarDiamention( carId ,Length ,Width ,Height ,WheelBase ,GroundClerance ,FrontTrack ,RearTrack ,FuelTank) VALUES( @carId ,@Length ,@Width ,@Height ,@WheelBase ,@GroundClerance ,@FrontTrack ,@RearTrack ,@FuelTank)"; int rowsAffected = connection.Execute(sql, model); return(rowsAffected); } }
public ActionResult Create(CarDiamention model) { if (ModelState.IsValid) { MasterRepository repo = new MasterRepository(); repo.SaveCarDiamention(model); return(RedirectToAction("Create")); } else { return(View(model)); } }
public ActionResult Create() { CarDiamention model = new CarDiamention(); return(View(model)); }