예제 #1
0
        public Response <bool> SavePerson([FromBody] Person person)
        {
            Response <bool> response = new Response <bool>()
            {
                Item = false
            };

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

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

            context.UpdatePerson(person);
        }