/// <summary> /// The method removes an entity from the storage /// </summary> /// <param name="entity">The entity</param> public void Delete(Offer entity) { if (entity == null) { throw new ArgumentNullException(); } using (DbContext context = new DbContext()) { context.Offers.Remove(entity); context.SaveChangesAsync(); } }
/// <summary> /// The method removes an entity from the storage /// </summary> /// <param name="entity">The entity</param> public async void Delete(AspNetUsers entity) { if (entity == null) { throw new ArgumentNullException(); } using (DbContext context = new DbContext()) { if (string.IsNullOrEmpty(entity.Id)) { context.AspNetUsers.Remove(entity); } await context.SaveChangesAsync(); } }
/// <summary> /// The method writes an entity to the storage /// </summary> /// <param name="entity">The entity</param> public void Save(Offer entity) { if (entity == null) { throw new ArgumentNullException(); } if (entity.OfrId == 0) { entity.OfrAuditCd = DateTime.Now; } entity.OfrAuditMd = DateTime.Now; using (DbContext context = new DbContext()) { context.Offers.Add(entity); context.SaveChangesAsync(); } }