public void Update(IPostcode postcode) { Data.PostcodeDetails postcodeDetails = Map(postcode); _postcodeDbContext.Postcodes.Attach(postcodeDetails); _postcodeDbContext.Entry(postcodeDetails).State = EntityState.Modified; _postcodeDbContext.SaveChanges(); }
public static void Update <T>(IPostcode postcode) { IPostcode updateCandidate = _postcodes.First(p => p.Id == postcode.Id); foreach (PropertyInfo property in typeof(IPostcode).GetProperties().Where(p => p.Name != "Id")) { property.SetValue(updateCandidate, property.GetValue(postcode), null); } }
private Data.PostcodeDetails Map(IPostcode postcode) { return(new Data.PostcodeDetails { Id = postcode.Id, Postcode = postcode.Postcode, County = postcode.County, District = postcode.District, Latitude = postcode.Latitude, Longitude = postcode.Longitude, Region = postcode.Region, Ward = postcode.Ward }); }
public void Update(IPostcode postcode) { Parsers.Update <PostcodeDetails>(postcode); }
public ActionResult Edit(int id) { IPostcode postcodeToEdit = _postcodeService.Get().First(p => p.Id == id); return(PartialView(postcodeToEdit)); }