public Task CreateAsync(Order item) { try { _yapartStoreContext.Orders.Add(item); return(_yapartStoreContext.SaveChangesAsync()); } catch (Exception e) { throw e; } }
public Task DeleteAsync(int id) { return(Task.Run(() => { var item = _yapartStoreContext.OrderItems.First(i => i.Id == id); if (item != null) { _yapartStoreContext.OrderItems.Remove(item); _yapartStoreContext.SaveChangesAsync(); } })); }