public async Task <bool> ExistAsync(Guid id) { var request = await _context .FindAsync <ClientRequest>(id); return(request != null); }
public virtual async Task <T> GetAsync(Guid aId) { try { return(await Context.FindAsync <T>(aId)); } catch (Exception e) { throw new Exception(e.Message); } }
public async Task <TEntity> GetById(int id) { if (id == 0) { throw new ArgumentException($"{nameof(GetById)} id must not be empty"); } try { return(await productContext.FindAsync <TEntity>(id)); } catch (Exception ex) { throw new Exception($"Couldn't retrieve entities: {ex.Message}"); } }
public async Task <Result> DeleteProduct(int id) { var product = await _productContext.FindAsync <Product>(id); if (product != null) { _productContext.Remove <Product>(product); await _productContext.SaveChangesAsync(); } else { } return(await Task.FromResult <Result>(new Result() { IsSuccess = true, Message = "Done" })); }
public async Task <Product> GetByAsync(Guid id) { return(await _context.FindAsync <Product>(id)); }