Ejemplo n.º 1
0
        public HttpResponseMessage Get([FromUri] int TissueBankId)
        {
            TissueBankApiModel       tbApiModel  = new TissueBankApiModel();
            TransactionalInformation transaction = new TransactionalInformation();

            TissueBankBusinessService tissueBankBusinessService = new TissueBankBusinessService(tbDataService);

            usp_TissueBank_Get_Result tissueBank = tissueBankBusinessService.GetTissueBankById
                                                       (TissueBankId, out transaction);

            tbApiModel.tissueBank     = tissueBank;
            tbApiModel.ReturnStatus   = transaction.ReturnStatus;
            tbApiModel.ReturnMessage  = transaction.ReturnMessage;
            tbApiModel.IsAuthenicated = true;

            if (transaction.ReturnStatus == true)
            {
                var response = Request.CreateResponse <TissueBankApiModel>(HttpStatusCode.OK, tbApiModel);
                return(response);
            }

            var badResponse = Request.CreateResponse <TissueBankApiModel>(HttpStatusCode.BadRequest, tbApiModel);

            return(badResponse);
        }
Ejemplo n.º 2
0
        public usp_TissueBank_Get_Result GetTissueBankById(int TissueBankId, out TransactionalInformation transaction)
        {
            transaction = new TransactionalInformation();

            usp_TissueBank_Get_Result tissueBank = null;

            try
            {
                tbDataService.CreateSession();
                tissueBank = tbDataService.GetTissueBankById(TissueBankId, out transaction);
            }
            catch (Exception ex)
            {
                transaction.ReturnMessage = new List <string>();
                string errorMessage = ex.Message;
                transaction.ReturnStatus = false;
                transaction.ReturnMessage.Add(errorMessage);
            }
            finally
            {
                tbDataService.CloseSession();
            }

            return(tissueBank);
        }