コード例 #1
0
        public ProductListResponse GetProductList()
        {
            ProductListResponse response = new ProductListResponse();

            using (MyDb db = new MyDb())
            {
                try
                {
                    response.Products = db.Products.ToList();
                    if (response.Products == null)
                    {
                        response.SetError(Common.SystemConstant.SystemConstants.ERRORS.NOTFOUND);
                    }
                    else
                    {
                        response.SetError(Common.SystemConstant.SystemConstants.ERRORS.SUCCESSFUL);
                    }
                }
                catch (Exception ex)
                {
                    response.SetError(Common.SystemConstant.SystemConstants.ERRORS.SYSTEMERROR);
                }
                return(response);
            }
        }