コード例 #1
0
        public ActionResult Create(GenericControlValueViewModel model, string returnUrl)
        {
            ActionResult action;

            try
            {
                if (!ModelState.IsValid)
                {
                    ModelState.AddModelError("", MessageUI.ErrorMessage);
                    return(View(model));
                }

                var modelMap = Mapper.Map <GenericControlValueViewModel, GenericControlValue>(model);
                _genericControlValueService.Create(modelMap);

                Response.Cookies.Add(new HttpCookie("system_message", string.Format(MessageUI.CreateSuccess, FormUI.Name)));
                if (!Url.IsLocalUrl(returnUrl) || returnUrl.Length <= 1 || !returnUrl.StartsWith("/") || returnUrl.StartsWith("//") || returnUrl.StartsWith("/\\"))
                {
                    action = RedirectToAction("Index");
                }
                else
                {
                    action = Redirect(returnUrl);
                }
            }
            catch (Exception ex)
            {
                LogText.Log(string.Concat("GenericControlValue.Create: ", ex.Message));

                return(View(model));
            }

            return(action);
        }
コード例 #2
0
        public ActionResult Create(GenericControlValueViewModel model, string ReturnUrl)
        {
            ActionResult action;

            try
            {
                if (!base.ModelState.IsValid)
                {
                    base.ModelState.AddModelError("", MessageUI.ErrorMessage);
                    return(base.View(model));
                }
                else
                {
                    GenericControlValue modelMap = Mapper.Map <GenericControlValueViewModel, GenericControlValue>(model);
                    this._genericControlValueService.Create(modelMap);

                    base.Response.Cookies.Add(new HttpCookie("system_message", string.Format(MessageUI.CreateSuccess, FormUI.Name)));
                    if (!base.Url.IsLocalUrl(ReturnUrl) || ReturnUrl.Length <= 1 || !ReturnUrl.StartsWith("/") || ReturnUrl.StartsWith("//") || ReturnUrl.StartsWith("/\\"))
                    {
                        action = base.RedirectToAction("Index");
                    }
                    else
                    {
                        action = this.Redirect(ReturnUrl);
                    }
                }
            }
            catch (Exception exception1)
            {
                Exception exception = exception1;
                ExtentionUtils.Log(string.Concat("GenericControlValue.Create: ", exception.Message));
                return(base.View(model));
            }
            return(action);
        }
コード例 #3
0
        public ActionResult Edit(int Id)
        {
            GenericControlValueViewModel genericControlValueViewModel = Mapper.Map <GenericControlValue, GenericControlValueViewModel>(this._genericControlValueService.GetById(Id));

            //_genericControlValueService.GetById(Id)


            return(base.View(genericControlValueViewModel));
        }
コード例 #4
0
        public ActionResult Create()
        {
            var model = new GenericControlValueViewModel
            {
                OrderDisplay = 1,
                Status       = (int)Status.Enable
            };

            return(View(model));
        }