예제 #1
0
        public Response <PersonDto> GetPerson(decimal id)
        {
            Response <PersonDto> response = new Response <PersonDto>();

            try
            {
                if (0 < id)
                {
                    using (PersonContext context = new PersonContext())
                    {
                        response = context.GetPerson(id);
                    }
                }
                else
                {
                    response.Item = null;
                    response.Code = OperationCode.ResponseCode.ERROR;
                    response.ErrorList.Add(MessageResource.GetInstance().GetText("SchoolAsIL_GetInvalid", MESSAGE_RESOURCE));
                }
            }
            catch (Exception ex)
            {
                string message = MessageResource.GetInstance().GetText("SchoolAsIL_GetException", MESSAGE_RESOURCE);

                // Configure the Exception response.
                response.Code = OperationCode.ResponseCode.EXCEPTION;
                response.ExceptionMessageList.Add(message);
                response.ExceptionList.Add(ex);

                //CIALogger.LogException(message, string.Format(MODULE, "Get"), ex);
            }

            return(response);
        }
예제 #2
0
        public Person GetPerson(int id)
        {
            PersonContext context = HttpContext.RequestServices.GetService(typeof(aplikacja1.Models.PersonContext)) as PersonContext;

            return(context.GetPerson(id));
        }