Beispiel #1
0
        public ActionResult General(Exception exception)
        {
            string additionalErrorMsg = null;

            additionalErrorMsg = exception.StackTrace;
            var            errorMsg         = exception.Message;
            var            errorModelManger = new ErrorModelManager(exception, RouteData.Values["controller"].ToString(), RouteData.Values["action"].ToString());
            ErrorViewModel errorModel       = errorModelManger.GetErrorViewModel(
                Resources.DyntaxaResource.SharedError,
                exception.GetType().Name,
                errorMsg,
                additionalErrorMsg);

            return(View("ErrorInfo", errorModel));
        }
        public ActionResult Info(string guid, int?taxonId)
        {
            if (guid == null)
            {
                var            errorModelManger = new ErrorModelManager(new Exception(), "Reference", "info");
                ErrorViewModel errorModel       = errorModelManger.GetErrorViewModel("Reference info error", "Reference info error", "No GUID (unique id) is specified.", null);
                return(View("ErrorInfo", errorModel));
            }

            var viewManager = new ReferenceViewManager(GetCurrentUser());
            var model       = viewManager.CreateReferenceInfoViewModel(guid);

            model.TaxonId = taxonId.HasValue ? taxonId.Value : TaxonIdentifier.Id;
            return(View(model));
        }
        public ActionResult Add(string guid, int?taxonId, string returnParameters, string returnController, string returnAction, bool showReferenceApplyMode = false)
        {
            if (guid == null)
            {
                var            errorModelManger = new ErrorModelManager(new Exception(), "Reference", "Add");
                ErrorViewModel errorModel       = errorModelManger.GetErrorViewModel("Add reference error", "Add reference error", "No GUID (unique id) is specified.", null);
                return(View("ErrorInfo", errorModel));
            }

            //// DyntaxaObjectType objectType = GuidHelper.GetObjectTypeFromGuid(guid);

            var viewManager             = new ReferenceViewManager(CoreData.UserManager.GetCurrentUser());
            ReferenceAddViewModel model = viewManager.CreateReferenceAddViewModel(guid, showReferenceApplyMode);
            var dicRouteValues          = new RouteValueDictionary();

            if (!string.IsNullOrEmpty(returnController) && !string.IsNullOrEmpty(returnAction))
            {
                //if (!string.IsNullOrEmpty(returnParameters))
                //    model.LinkParams = DecodeRouteQueryString(returnParameters);
                model.ReturnAction     = returnAction;
                model.ReturnController = returnController;
                model.ReturnParameters = returnParameters;

                if (!string.IsNullOrEmpty(returnParameters))
                {
                    dicRouteValues = DecodeRouteQueryString(returnParameters);
                }

                if (!dicRouteValues.ContainsKey("taxonId") && taxonId.HasValue)
                {
                    dicRouteValues.Add("taxonId", taxonId.Value);
                }
            }

            model.TaxonId     = taxonId.HasValue ? taxonId.Value : TaxonIdentifier.Id;
            model.RouteValues = dicRouteValues;

            return(View(model));
        }