Пример #1
0
        public System.Web.Mvc.JsonResult DoSomething5400(string name)
        {
            System.Threading.Thread.Sleep(5000);

            ViewModels.General.JsonResultViewModel
                result = new ViewModels.General.JsonResultViewModel();

            try
            {
                // Do Something

                result.IsSuccess = true;

                result.AddErrorMessage("Error Message 1");
                result.AddErrorMessage("Error Message 2");

                result.AddInformationMessage("Information Message 1");
                result.AddInformationMessage("Information Message 2");
                result.AddInformationMessage("Information Message 3");
            }
            catch             //(System.Exception ex)
            {
                // Log(ex)

                result.ClearNotHiddenMessages();

                result.AddErrorMessage("Unexpected Error!");
            }
            finally
            {
            }

            return(Json(data: result,
                        behavior: System.Web.Mvc.JsonRequestBehavior.AllowGet));
        }
Пример #2
0
        public System.Web.Mvc.JsonResult DoSomething5700(Models.Person inputViewModel)
        {
            System.Threading.Thread.Sleep(5000);

            ViewModels.General.JsonResultViewModel <Models.Person>
            result = new ViewModels.General.JsonResultViewModel <Models.Person>();

            try
            {
                Models.Person person = new Models.Person()
                {
                    LastName  = inputViewModel.LastName,
                    FirstName = inputViewModel.FirstName,
                };

                result.Data = person;

                result.IsSuccess = true;

                result.AddErrorMessage("Error Message 1");
                result.AddErrorMessage("Error Message 2");

                result.AddInformationMessage("Information Message 1");
                result.AddInformationMessage("Information Message 2");
                result.AddInformationMessage("Information Message 3");
            }
            catch             //(System.Exception ex)
            {
                // Log(ex)

                result.ClearErrorMessages();
                result.ClearInformationMessages();

                result.AddErrorMessage("Unexpected Error!");
            }
            finally
            {
            }

            //return (new Infrastructure.JsonNetResult
            //{
            //	Data = result,
            //});

            //return (Json(data: result, behavior: System.Web.Mvc.JsonRequestBehavior.AllowGet));

            return(JsonNet(data: result));
        }
Пример #3
0
        public System.Web.Mvc.JsonResult DoSomething5600(string firstName, string lastName)
        {
            System.Threading.Thread.Sleep(5000);

            ViewModels.General.JsonResultViewModel <Models.Person>
            result = new ViewModels.General.JsonResultViewModel <Models.Person>();

            try
            {
                Models.Person person = new Models.Person()
                {
                    LastName  = lastName,
                    FirstName = firstName,
                };

                result.Data = person;

                result.IsSuccess = true;

                result.AddErrorMessage("Error Message 1");
                result.AddErrorMessage("Error Message 2");

                result.AddInformationMessage("Information Message 1");
                result.AddInformationMessage("Information Message 2");
                result.AddInformationMessage("Information Message 3");
            }
            catch             //(System.Exception ex)
            {
                // Log(ex)

                result.ClearErrorMessages();
                result.ClearInformationMessages();

                result.AddErrorMessage("Unexpected Error!");
            }
            finally
            {
            }

            return(new Infrastructure.JsonNetResult
            {
                Data = result,
            });
        }