public void CreateProperty(PropertyEntitiy property) { _context.Entry(property).State = EntityState.Modified; _context.Properties.Add(property); _context.SaveChanges(); }
public static void PopulatePhotostring(this PropertyEntitiy property) { if (property.PhotosCollection != null) { foreach (var photo in property.PhotosCollection) { property.Photos.Add(photo.Url); } } }
public static void InitialiseJson(this PropertyEntitiy property) { if (property.Photos != null) { foreach (var photo in property.Photos) { property.PhotosCollection.Add(new PhotoEntity { Url = photo }); } } }
public void UpdateProperty(PropertyEntitiy property) { if (!PropertyExists(property.Id)) { return; } _context.Properties.Add(property); try { _context.SaveChanges(); } catch (DbUpdateConcurrencyException) { } }