コード例 #1
0
        private IdentityGroupProperty ExtractCreateFormData(GroupPropertyCreateModel formData)
        {
            var myIdetity = new IdentityGroupProperty();

            myIdetity.Name        = formData.Name;
            myIdetity.Description = formData.Description;
            //myIdetity.UrlFriendly = UrlFriendly.ConvertToUrlFriendly(formData.Name);
            myIdetity.Icon      = formData.Icon;
            myIdetity.Status    = Utils.ConvertToInt32(formData.Status);
            myIdetity.CreatedBy = User.Identity.GetUserId();

            return(myIdetity);
        }
コード例 #2
0
        public ActionResult Create(GroupPropertyCreateModel model)
        {
            var newId = 0;

            if (!ModelState.IsValid)
            {
                string messages = string.Join("; ", ModelState.Values
                                              .SelectMany(x => x.Errors)
                                              .Select(x => x.ErrorMessage + x.Exception));
                this.AddNotification(messages, NotificationType.ERROR);
                return(View(model));
            }

            try
            {
                //Begin db transaction
                var info = ExtractCreateFormData(model);

                newId = _mainStore.Insert(info);

                if (newId > 0)
                {
                    this.AddNotification(ManagerResource.LB_INSERT_SUCCESS, NotificationType.SUCCESS);
                }
                else
                {
                    this.AddNotification(NotifSettings.Error_SystemBusy, NotificationType.ERROR);
                }
            }
            catch (Exception ex)
            {
                this.AddNotification(NotifSettings.Error_SystemBusy, NotificationType.ERROR);

                logger.Error("Failed for Create GroupProperty request: " + ex.ToString());

                return(View(model));
            }

            return(RedirectToAction("Edit/" + newId));
        }
コード例 #3
0
        //[AccessRoleChecker]
        public ActionResult Create()
        {
            var createModel = new GroupPropertyCreateModel();

            return(View(createModel));
        }