コード例 #1
0
        public void TestGetSupplierByIdReturnsSupplierSuccess()
        {
            Models.Response.Supplier fakesupplierResponse = this.GetFakeSupplierResponseModel();

            this.MockGetAllSuppliersResponseTables(true);

            var result = supplierRepositoryMock.GetById(1).Result;

            Assert.IsNotNull(result.Result);
            Assert.IsTrue(result.Result.MGSupplier != null);
        }
コード例 #2
0
        public async Task <IActionResult> GetById(string id)
        {
            var record = await _SupplierService.GetById(id);

            if (record == null)
            {
                return(NotFound());
            }

            return(Ok(record));
        }
コード例 #3
0
ファイル: SupplierController.cs プロジェクト: antcorpinc/Dew
        public async Task <IActionResult> GetById(int id)
        {
            try
            {
                BaseResult <Models.Response.Supplier> result = await _iSupplierRepository.GetById(id);

                if (result.IsError && result.ExceptionMessage != null)
                {
                    return(new StatusCodeResult(500));
                }
                if (result.Result == null)
                {
                    return(NoContent()); //204
                }
                return(Ok(result));
            }
            catch (Exception ex)
            {
                Dictionary <string, string> inputParameter = new Dictionary <string, string>();
                LogHelper.LogError(_iLogger, Constants.AppName, "GetById", "Error Occurred. ", "SupplierController", ex, Constants.InternalErrorStatusCode, null);
                return(new StatusCodeResult(500));
            }
        }