Exemplo n.º 1
0
        public async Task<ActionResult> Create(RoleCreateModel model)
        {
            var role = new Role();


            if (!TryUpdateModel(role, model))
            {
                return Template(model.CreateTemplate(ControllerContext));
            }
            var db = MaintDbContext;

            db.Roles.Add(role);
            await db.SaveChangesAsync();
            await SetFlashAsync(new FlashMessage
            {
                Text = MaintCultureTextResources.SuccessToSave,
                MessageType = FlashMessageType.Success,
            });
            return Create();
        }
Exemplo n.º 2
0
partial         void OnToEntity(Role entity, ControllerContext controllerContext);
Exemplo n.º 3
0
        public void ToEntity(Role entity, ControllerContext controllerContext)
        {
            entity.Name = Name;

            entity.PrivilegeArray = MappingPrivilegeArrayToEntity(entity, controllerContext);
            entity.IsEnabled = IsEnabled;
            OnToEntity(entity, controllerContext);
        }
Exemplo n.º 4
0
partial         void OnFromEntity(Role entity, bool isPostback, ControllerContext controllerContext);
Exemplo n.º 5
0
        public void FromEntity(Role entity, bool isPostback, ControllerContext controllerContext)
        {
            if(!isPostback){

                Name = entity.Name;

                PrivilegeArray = MappingPrivilegeArrayFromEntity(entity, controllerContext);

                IsEnabled = entity.IsEnabled;
            }
            OnFromEntity(entity, isPostback, controllerContext);
        }