public ActionResult CreateCompanyFeatureList() { var featureList = service.GetAll(AuthenticationHelper.CompanyId.Value, AuthenticationHelper.UserRole, "company").ToList(); CreateCompanyFeatureListModel model = new CreateCompanyFeatureListModel(); model.CompanyId = AuthenticationHelper.CompanyId.Value; model.FeatureList = featureList.Select(x => new FeatureViewModel(x)).ToList(); return(View(model)); }
public async Task <IActionResult> Create(int?FeatureId) { if (User.IsInRole(Roles.Client) || !User.Identity.IsAuthenticated) { return(NotFound()); } var features = await _featureService.GetAll(); ViewBag.Features = new SelectList(features.ToList(), "Id", "Title", FeatureId); return(View()); }
// GET: Admin/Feature public ActionResult Index(int?Page) { int pageIndex = Protector.Int(Page, 1); // nếu page = 0 thì gán page = 1 int pageSize = ConstantsHandler.PAGE_50; var model = new FeatureModel(); var list = _featureService.GetAll(model, pageIndex, pageSize); long lCount = list.Count; #region Paging if (lCount > 0) { ViewData["Stt"] = (pageIndex - 1) * pageSize + 1; if (Paging.GetUrl(this.Request.Url.PathAndQuery) == this.Request.Url.AbsolutePath) { ViewData["Page"] = Paging.PagingAdmin(this.Request.Url.AbsolutePath, lCount, pageSize, pageIndex, 1); } else { ViewData["Page"] = Paging.PagingAdmin(Paging.GetUrl(this.Request.Url.PathAndQuery), lCount, pageSize, pageIndex, 2); } } #endregion ViewBag.Count = list.Count; return(View(list.List)); }
public IHttpActionResult Get() { try { var re = Request; var headers = re.Headers; if (headers.Contains("Token")) { string token = headers.GetValues("Token").First(); User loggedUser = _userService.GetFromToken(token); if (loggedUser.Role == UserRoles.ADMIN || loggedUser.Role == UserRoles.SUPERADMIN) { List <Feature> allFeatures = _featureService.GetAll(); return(Ok(allFeatures)); } return(BadRequest("Solo los administradores pueden ver las características")); } return(BadRequest("Debes mandar el Token de sesión en los headers")); } catch (NoUserWithTokenException ex) { return(BadRequest(ex.Message)); } }
public object GetFeatureWorklist() { try { return(featureService.GetAll(new Feature())); } catch (Exception ex) { return(errorLogService.InsertToErrorLog(ex, MethodBase.GetCurrentMethod().Name, Request.Headers["UserInfo"].ToString())); } }
public IActionResult Get() { var list = featureService.GetAll(); if (list != null) { return(Ok(list)); } else { return(NotFound("Empty")); } }
public ActionResult CreateCompanyFeatureList() { IEnumerable <Feature> featureList = service.GetAll(long.MaxValue).ToList(); ////here company argument doesn't require IEnumerable <Company> companyList = companyService.GetAll(long.MaxValue); CreateCompanyFeatureListModel model = new CreateCompanyFeatureListModel(); model.FeatureList = featureList.Select(x => new FeatureViewModel(x)).ToList(); model.CompanyList = companyList.Select(x => new SelectListItem { Text = x.Name, Value = x.Id.ToString() }).ToList(); return(View(model)); }
public async Task <IActionResult> Index() { var controller = nameof(FeaturesController).Split("Controller")[0]; var data = await _productFeatureService.GetAll(); var html = "index"; if (User.IsInRole(Roles.Owner) || User.Identity.IsAuthenticated) { html = "manage"; } return(View($"~/Views/{controller}/{html}.cshtml", data)); }
public object GetPermissionWorklist(int roleId = 1) { try { IEnumerable <Feature> featureList = featureService.GetAll(new Feature()); IEnumerable <PermissionViewModel> permissionList = permissionService.GetPermissionWorklist(roleId); List <PermissionViewModel> permissionWorklist = new List <PermissionViewModel>(); PermissionViewModel permissionObj = new PermissionViewModel(); foreach (Feature f in featureList) { var item = permissionList.FirstOrDefault(i => i.FeatureId == f.Id); if (item != null) { permissionObj.IsAddPermitted = item.IsAddPermitted; permissionObj.IsDeletePermitted = item.IsDeletePermitted; permissionObj.IsEditPermitted = item.IsEditPermitted; permissionObj.IsRegistrationPermitted = item.IsRegistrationPermitted; permissionObj.IsSecuredviewPermitted = item.IsSecuredviewPermitted; permissionObj.IsViewPermitted = item.IsViewPermitted; permissionObj.RoleId = roleId; permissionObj.FeatureId = f.Id; permissionObj.FeatureName = f.Alias; permissionObj.Id = item.Id; permissionWorklist.Add(permissionObj); } else { permissionObj.RoleId = roleId; permissionObj.FeatureId = f.Id; permissionObj.FeatureName = f.Alias; permissionWorklist.Add(permissionObj); } permissionObj = new PermissionViewModel(); } return(permissionWorklist); } catch (Exception ex) { return(errorLogService.InsertToErrorLog(ex, MethodBase.GetCurrentMethod().Name, Request.Headers["UserInfo"].ToString())); } }
public async Task <IActionResult> AddProductAttribute(int?productId) { if (productId == null) { return(NotFound()); } if (User.IsInRole(Roles.Client) || !User.Identity.IsAuthenticated) { return(NotFound()); } var model = await _productService.Get(productId); var vm = new ProductAttribute { ProductsId = model.Id, }; ViewBag.Categories = new SelectList((await _shopCategoryService.GetAll()).ToList(), "Id", "Title"); ViewBag.Features = new SelectList((await _featureService.GetAll()).ToList(), "Id", "Title"); ViewBag.Attributes = new SelectList((await _featureAttributeService.GetAll()).ToList(), "Id", "Title"); return(View(vm)); }
public IList <Core.Dto.Feature> Get() { IList <Core.Dto.Feature> features = _featureService.GetAll(); return(features); }