예제 #1
0
        public void Update(IPostcode postcode)
        {
            Data.PostcodeDetails postcodeDetails = Map(postcode);
            _postcodeDbContext.Postcodes.Attach(postcodeDetails);
            _postcodeDbContext.Entry(postcodeDetails).State = EntityState.Modified;

            _postcodeDbContext.SaveChanges();
        }
예제 #2
0
        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);
            }
        }
예제 #3
0
 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
     });
 }
예제 #4
0
 public void Update(IPostcode postcode)
 {
     Parsers.Update <PostcodeDetails>(postcode);
 }
예제 #5
0
        public ActionResult Edit(int id)
        {
            IPostcode postcodeToEdit = _postcodeService.Get().First(p => p.Id == id);

            return(PartialView(postcodeToEdit));
        }