Exemplo n.º 1
0
        public Response <PersonDto> UpdatePerson([FromBody] Person person)
        {
            Response <PersonDto> response = new Response <PersonDto>();

            try
            {
                if (person != null)
                {
                    using (PersonContext context = new PersonContext())
                    {
                        response = context.AddEmployee(new Request <Person>()
                        {
                            Item = person
                        });
                    }
                }
                else
                {
                    response.Code = OperationCode.ResponseCode.ERROR;
                    response.ErrorList.Add(MessageResource.GetInstance().GetText("SchoolAsIL_PutInvalid", MESSAGE_RESOURCE));
                }
            }
            catch (Exception ex)
            {
                string message = MessageResource.GetInstance().GetText("SchoolAsIL_PutException", 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, "Put"), ex);
            }

            return(response);
        }