public IActionResult Delete(int id)
        {
            IActionResult ret    = null;
            Product       entity = null;

            try
            {
                using (var db = new CFEDbContext())
                {
                    entity = db.Products.Find(id);
                    if (entity != null)
                    {
                        db.Products.Remove(entity);
                        db.SaveChanges();
                    }
                    ret = StatusCode(StatusCodes.Status200OK, true);
                }
            }
            catch (Exception ex)
            {
                ret = HandleException(ex, "Exception trying to delete product: " + id.ToString());
            }

            return(ret);
        }
        public IActionResult Post([FromBody] Product entity)
        {
            IActionResult ret = null;

            try
            {
                using (var db = new CFEDbContext())
                {
                    if (entity != null)
                    {
                        db.Products.Add(entity);
                        db.SaveChanges();
                        ret = StatusCode(StatusCodes.Status201Created,
                                         entity);
                    }
                    else
                    {
                        ret = StatusCode(StatusCodes.Status400BadRequest, "Invalid object passed to POST method");
                    }
                }
            }
            catch (Exception ex)
            {
                ret = HandleException(ex, "Exception trying to insert a new product");
            }

            return(ret);
        }
        public IActionResult Put([FromBody] Product entity)
        {
            IActionResult ret = null;

            try
            {
                using (var db = new CFEDbContext())
                {
                    if (entity != null)
                    {
                        db.Update(entity);
                        db.SaveChanges();
                        ret = StatusCode(StatusCodes.Status200OK, entity);
                    }
                    else
                    {
                        ret = StatusCode(StatusCodes.Status400BadRequest, "Invalid object passed to PUT method");
                    }
                }
            }
            catch (Exception ex)
            {
                ret = HandleException(ex, "Exception trying to update product: " + entity.ProductId.ToString());
            }

            return(ret);
        }