当前位置: 首页>>代码示例>>C#>>正文


C# RoleViewModel类代码示例

本文整理汇总了C#中RoleViewModel的典型用法代码示例。如果您正苦于以下问题:C# RoleViewModel类的具体用法?C# RoleViewModel怎么用?C# RoleViewModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RoleViewModel类属于命名空间,在下文中一共展示了RoleViewModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddRoles

        public ActionResult AddRoles(Guid productId, string version, string error = null)
        {
            if(error != null)
            {
                ModelState.AddModelError("", error);
            }

            var product = _productRepository.Find(productId);

            var currentRoles = product.Versions.Single(x => x.Name == version).Roles.Select(x => x.Name);

            var baseImages = _baseImageRepository.FindAll().ToDictionary(x => x.Id, x => x.Name);
            var model = new RoleViewModel
            {
                ProductId = productId,
                ProductName = product.Name,
                VersionName = version,
                BaseImages = baseImages,
                Ports = new List<PortViewModel> {  new PortViewModel { DnsTtl = 3600}},
                CurrentRoles = currentRoles.ToList(),
                VolumeSize = 60,
                InstanceTypes = _stackItConfiguration.InstanceTypes.Select(x => x.Name).ToList()
            };

            return View(model);
        }
开发者ID:nelsonwellswku,项目名称:stack-it-net,代码行数:26,代码来源:ProductController.cs

示例2: ManageRole

        public ActionResult ManageRole(RoleViewModel model)
        {
            if (model.Role == null)
            {
                model.Role = new Role();
            }

            if (!string.IsNullOrEmpty(model.Role.sort))
            {
                model.Role.SortExp = model.Role.sort + " " + model.Role.sortdir;
            }

            if (model.Role.PageSize == 0)
            {
                int PageSize = Convert.ToInt32(ConfigurationManager.AppSettings["PageSize"]);
                model.Role.PageSize = PageSize;
            }

            if (model.Role.PageIndex == 0)
            {
                model.Role.PageIndex = 1;
            }
            model.RoleList = new List<Role>();
            model.Role.TotalCount = 0;
            model.RoleList = _IRoleService.GetAll(model.Role).ToList();
            if (model.RoleList != null && model.RoleList.Count > 0)
            {
                int TotalCount = model.RoleList[0].TotalCount;
                model.Role.TotalCount = TotalCount;
            }

            return View(model);
        }
开发者ID:stiqraschool,项目名称:eSchool,代码行数:33,代码来源:RoleController.cs

示例3: getRoleFromId

        public RoleViewModel getRoleFromId(string id)
        {
            var db = new BwareContext();
            var roleViewModel = new RoleViewModel();

            roleViewModel = db.AspNetRoles.Where(r => r.Name == id).Select(r => new RoleViewModel() { CurrentName = r.Name }).FirstOrDefault();
            return roleViewModel;
        }
开发者ID:jdsv650,项目名称:BwareAdmin,代码行数:8,代码来源:RoleAdapter.cs

示例4: ToViewModel

 public static RoleViewModel ToViewModel(IdentityRole Role)
 {
     var roleViewModel = new RoleViewModel()
     {
         Id = Role.Id,
         Name = Role.Name
     };
     return roleViewModel;
 }
开发者ID:nguyenquocphuong,项目名称:AddressBook_IDC,代码行数:9,代码来源:RoleViewModel.cs

示例5: Create

        /// <summary>
        /// 新增角色
        /// </summary>
        /// <returns></returns>
        public ActionResult Create()
        {
            var viewModel = new RoleViewModel
            {
                MenuCheckList = roleService.GetMenuByRoleId(null)
            };

            return View(viewModel);
        }
开发者ID:creatidea-tw,项目名称:Ci.Template,代码行数:13,代码来源:RoleController.cs

示例6: GetAllRoles

 public List<RoleViewModel> GetAllRoles()
 {
     var rolesList = new List<RoleViewModel>();
     foreach (var role in _db.Roles)
     {
         var roleModel = new RoleViewModel(ConvertRole(role));
         rolesList.Add(roleModel);
     }
     return rolesList;
 }
开发者ID:21428432,项目名称:Basic,代码行数:10,代码来源:RolesBusiness.cs

示例7: ToViewModel

        public static RoleViewModel ToViewModel(this Model.Role rolePOCO)
        {
            var roleViewModel = new RoleViewModel();

            return new RoleViewModel()
            {
                roleID = rolePOCO.roleID,
                roleName = rolePOCO.roleName,
            };
        }
开发者ID:simon8029,项目名称:EmailPromotionManagementDemo,代码行数:10,代码来源:ViewModelExtension.cs

示例8: Modify

 public ActionResult Modify(int id, RoleViewModel viewmodel)
 {
     if (ModelState.IsValid)
     {
         viewmodel.roleID =id ;
         OperationContext.ServiceSession.RoleService.Update(viewmodel.ToPOCO(), "roleName",  "roleIsDeleted");
         OperationContext.ServiceSession.SaveChange();
         return OperationContext.SendAjaxMessage(AjaxMessageStatus.OperationSuccess, "", "", null);
     }
     return OperationContext.SendAjaxMessage(AjaxMessageStatus.OperationFailed, "Please enable javascript in the browser", "", null);
 }
开发者ID:simon8029,项目名称:EmailPromotionManagementDemo,代码行数:11,代码来源:RoleController.cs

示例9: Edit

        public ActionResult Edit(RoleViewModel vmChanged)
        {
            var vm = GetViewModelFromTempData<RoleViewModel>();
            if (vm == null) { return RedirectToReferrer(); }

            vm.DisplayName = Strings.RoleDetailView_Title;
            vm.LatestControllerAction = ControllerAction.Edit;
            vm.ApplyFormAttributes(vmChanged.SelectedItem);

            return StoreEntity(vm);
        }
开发者ID:ikelos555,项目名称:HSROrderApp,代码行数:11,代码来源:RoleController.cs

示例10: Edit

        public async Task<ActionResult> Edit(string id)
        {
            if (id == null) return new HttpStatusCodeResult(HttpStatusCode.BadRequest);

            var role = await IdentityRepository.RoleManager.FindByIdAsync(id);

            if (role == null) return HttpNotFound();

            RoleViewModel roleModel = new RoleViewModel { Id = role.Id, Name = role.Name };

            return View(roleModel);
        }
开发者ID:zarkodam,项目名称:_6tactics.AspIdentity,代码行数:12,代码来源:RolesAdministrationController.cs

示例11: ToViewModel

 public static RoleViewModel ToViewModel(this IdentityRole role)
 {
     string Editor = "<a class='btn btn-success' href='javascript:void(0);'><i class='fa fa-cog'></i> 编辑</a>";
     string Delete = "<a class='btn btn-danger' href='javascript:void(0);'><i class='fa fa-remove'></i> 删除</a></td>";
     RoleViewModel model = new RoleViewModel()
     {
         Id = role.Id,
         Name = role.Name,
         Other = string.Format(Delete+Editor),
     };
     return model;
 }
开发者ID:Yumwey,项目名称:BootStrapCss,代码行数:12,代码来源:RoleViewModel.cs

示例12: Create

 public async Task<ActionResult> Create(RoleViewModel roleViewModel) {
     if (ModelState.IsValid) {
         var role = new IdentityRole(roleViewModel.Name);
         var roleresult = await RoleManager.CreateAsync(role);
         if (!roleresult.Succeeded) {
             ModelState.AddModelError("", roleresult.Errors.First());
             return View();
         }
         return RedirectToAction("Index");
     }
     return View();
 }
开发者ID:Nestornjrz,项目名称:Archivos,代码行数:12,代码来源:RolesAdminController.cs

示例13: Add

 public ActionResult Add(RoleViewModel viewModel)
 {
     if (ModelState.IsValid)
     {
         OperationContext.ServiceSession.RoleService.Add(viewModel.ToPOCO());
         OperationContext.ServiceSession.SaveChange();
         return OperationContext.SendAjaxMessage(AjaxMessageStatus.OperationSuccess, "", "", null);
     }
     else
     {
         return OperationContext.SendAjaxMessage(AjaxMessageStatus.OperationFailed, "Please enable javascript in browser.", "", null);
     }
 }
开发者ID:simon8029,项目名称:EmailPromotionManagementDemo,代码行数:13,代码来源:RoleController.cs

示例14: Add

        public ActionResult Add(RoleViewModel model)
        {
            if (!this.ModelState.IsValid)
            {
                return this.View(model);
            }

            this.roles.Add(model.Name);

            this.SetTempDataSuccessMessage(string.Format("The role {0} was added successfully!", model.Name));

            return this.RedirectToAction("Index", "Roles");
        }
开发者ID:TsvetanMilanov,项目名称:Employer-Employee-Hunt,代码行数:13,代码来源:RolesController.cs

示例15: Create

        public async Task<ActionResult> Create(RoleViewModel roleViewModel)
        {
            if (!ModelState.IsValid) return View();

            var role = new IdentityRole(roleViewModel.Name);

            IdentityResult result = await IdentityRepository.RoleManager.CreateAsync(role);

            IsResultNotSucceededAddModelError(result);

            if (result.Succeeded) return RedirectToAction("Index");

            return View();
        }
开发者ID:zarkodam,项目名称:_6tactics.AspIdentity,代码行数:14,代码来源:RolesAdministrationController.cs


注:本文中的RoleViewModel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。