Exemplo n.º 1
0
        public async Task <IHttpActionResult> DeleteCustomer(int?id)
        {
            ErrorLog error  = new ErrorLog();
            int      result = 0;

            if (id <= 0)
            {
                string message = "Bad request, no id parameter  to delete customer";
                error.WriteErrorLog(message);

                return(BadRequest());
            }
            try
            {
                result = await db.DeleteCustomer(id);

                if (result == 0)
                {
                    return(NotFound());
                }
                return(Ok());
            }
            catch (Exception ex)
            {
                error.WriteErrorLog(ex.Message);
                return(BadRequest());
            }
        }