public async Task <ActionResult <Customers> > PostCustomers(Customers customers) { // check for duplicate Email if (_repo.Exists(customers.Email)) { return(Conflict()); } try { await _repo.Add(customers); return(CreatedAtAction("GetCustomers", new { id = customers.Id }, customers.Id)); } catch (DbUpdateException) { return(new StatusCodeResult(422)); } }
private bool CustomerExists(Guid id) { return(_customersRepo.Exists(id)); }