Exemplo n.º 1
0
        public async Task <IActionResult> DeleteCustomer(GetCustomerByCustomerIdViewModel vm)
        {
            var CustomerById = await ctx.Customers.Where(x => x.CustomerId == vm.CustomerId).FirstOrDefaultAsync();

            try
            {
                ctx.Customers.Remove(CustomerById);
                await ctx.SaveChangesAsync();
            }
            catch (Exception e)
            {
                throw e;
            }
            return(Ok());
        }
Exemplo n.º 2
0
        public async Task <IActionResult> GetCustomerByCustomerId(GetCustomerByCustomerIdViewModel vm)
        {
            var CustomerById = await ctx.Customers.Where(x => x.CustomerId == vm.CustomerId).FirstOrDefaultAsync();

            return(Ok(CustomerById));
        }