public async Task <CoffeeModel> GetCoffeeByIdAsync(int id) { var CoffeeModel = new CoffeeModel(); var coffee = await _context.Set <Coffee>().FindAsync(id); return(CoffeeModel.Assign(coffee)); }
public async Task <CoffeeModel> CreateCoffeeAsync(CoffeeModel model) { var coffee = new Coffee(); coffee.Assign(model); await _context.Set <Coffee>().AddAsync(coffee); await _context.SaveChangesAsync(); model.Assign(coffee); return(model); }