public IActionResult Post([FromBody] SharedCustomers customer) { if (customer == null) { return(BadRequest()); } var newCustomer = repository.Add(customer); return(CreatedAtRoute("GetCustomer", new { id = newCustomer.Id, name = newCustomer.Name }, newCustomer)); }
public bool PublishCustomerExists(int customerId) { var message = new SharedCustomers { Id = customerId }; var response = bus.Request <SharedCustomers, SharedCustomers>(message); if (response != null) { return(true); } else { return(false); } }
public IActionResult Put(int id, [FromBody] SharedCustomers customer) { if (customer == null || customer.Id != id) { return(BadRequest()); } var modifiedCustomer = repository.Get(id); if (modifiedCustomer == null) { return(NotFound()); } modifiedCustomer.Name = customer.Name; modifiedCustomer.Email = customer.Email; modifiedCustomer.Phone = customer.Phone; modifiedCustomer.BillingAddress = customer.BillingAddress; modifiedCustomer.ShippingAddress = customer.ShippingAddress; modifiedCustomer.CreditStanding = customer.CreditStanding; repository.Edit(modifiedCustomer); return(new NoContentResult()); }