public async Task DeleteAsync(int id) { Content content = _db.Content.Where(p => p.Id == id).FirstOrDefault(); _db.Entry(content).State = EntityState.Deleted; await _db.SaveChangesAsync(); }
public virtual async Task DeleteAddressAsync(int id) { Models.Address address = await GetAddressByIdAsync(id); _db.Entry(address).State = EntityState.Deleted; await _db.SaveChangesAsync(); }
public async Task <PropertyListing> ReloadReferences(PropertyListing property) { _db.Entry(property).State = EntityState.Added; await _db.Entry(property).Collection(s => s.Media).LoadAsync(); await _db.Entry(property).Collection(s => s.FloorPlans).LoadAsync(); await _db.Entry(property).Reference(s => s.Agent).LoadAsync(); await _db.Entry(property).Collection(s => s.Metadata).LoadAsync(); return(property); }