private bool EditCounty(string countyId, string name, string stateID) { var _db = new WebApplication1.HalonModels.HalonContext(); int county_ID = Convert.ToInt32(countyId); var myCounty = (from c in _db.Counties where c.County_ID == county_ID select c).FirstOrDefault(); myCounty.County_Name = name; myCounty.State_ID = Convert.ToInt32(stateID); // Add product to DB. _db.SaveChanges(); // Success. return true; }
private bool AddCounty(string name, string stateID) { var _db = new WebApplication1.HalonModels.HalonContext(); HalonModels.County myCounty = new HalonModels.County(); myCounty.County_Name = name; myCounty.State_ID = Convert.ToInt32(stateID); // Add product to DB. _db.Counties.Add(myCounty); _db.SaveChanges(); // Success. return true; }