public ActionResult Create(ErrorDto errorDto)
        {
            Error error = Error.Create(errorDto);
            ErrorManager.Save(error);

            ErrorDto savedErrorDto = ErrorDto.Create(error);

            return new JsonServiceStackResult(savedErrorDto);
        }
Exemplo n.º 2
0
        public ActionResult Create(ErrorDto errorDto)
        {
            Error error = Error.Create(errorDto);
            ErrorManager.Save(error);

            ErrorDto savedErrorDto = ErrorDto.Create(error);

            return new JsonDataContractActionResult(savedErrorDto);
        }
Exemplo n.º 3
0
        public JsonResult Create(ErrorDto errorDto)
        {
            ErrorDto savedErrorDto;

            using (ITransaction transaction = Session.BeginTransaction())
            {
                Error error = Error.Create(errorDto);
                ErrorManager.Save(error);

                savedErrorDto = ErrorDto.Create(error);

                transaction.Commit();
            }

            return Json(savedErrorDto);
        }
        public void CreateError_ShortMessage_ErrorCreated()
        {
            ErrorDto errorDto = new ErrorDto
                {
                    Message = "Hello World",
                    ClientVersion = "0.99",
                    LineNumber = 2
                };

            NHibernateSessionManager.Instance.OpenSessionAndBeginTransaction();
            JsonServiceStackResult result = (JsonServiceStackResult)ErrorController.Create(errorDto);
            NHibernateSessionManager.Instance.CommitTransactionAndCloseSession();

            ErrorDto createdErrorDto = (ErrorDto)result.Data;

            Assert.NotNull(createdErrorDto);
        }
        public void CreateError_LongMessage_MessageTruncatedErrorCreated()
        {
            ErrorDto errorDto = new ErrorDto
            {
                Message = "Hello World This is a Really Long Message Which is going to be over 255 characters in length when finished which will cause the end result message to be truncated with three periods as to not overflow the database. Can I confirm that this is happening? Thanks",
                ClientVersion = "0.99",
                LineNumber = 2
            };

            NHibernateSessionManager.Instance.OpenSessionAndBeginTransaction();
            JsonServiceStackResult result = (JsonServiceStackResult)ErrorController.Create(errorDto);
            NHibernateSessionManager.Instance.CommitTransactionAndCloseSession();

            ErrorDto createdErrorDto = (ErrorDto)result.Data;

            Assert.NotNull(createdErrorDto);
            Assert.That(createdErrorDto.Message.Length == 255);
        }
Exemplo n.º 6
0
        public static ErrorDto Create(Error error)
        {
            ErrorDto errorDto = Mapper.Map <Error, ErrorDto>(error);

            return(errorDto);
        }