// GET: Vendor public ActionResult Index() { IFunctionService svc = new FunctionService(); var model = svc.GetAll(); return(View("~/Views/Master/Function/Index.cshtml", model)); }
public async Task <IViewComponentResult> InvokeAsync() { var roles = ((ClaimsPrincipal)User).GetSpecificClaim("Roles"); List <Function> functions; if (roles.Split(";").Contains(CommonConstants.AppRole.AdminRole)) { functions = await _functionService.GetAll(); } else { //TODO: Get by permission functions = await _functionService.GetAll(); } return(View(functions)); }
public ActionResult Download(Master_Menu model) { try { XLWorkbook xlWorkBook = new XLWorkbook(); var xlWorkSheet = xlWorkBook.Worksheets.Add("Master Function");// xlWorkSheet; xlWorkSheet.Cell(1, 1).Value = "MenuId"; xlWorkSheet.Cell(1, 2).Value = "ParentId"; xlWorkSheet.Cell(1, 3).Value = "MenuName"; xlWorkSheet.Cell(1, 4).Value = "Text"; xlWorkSheet.Cell(1, 5).Value = "Form"; xlWorkSheet.Cell(1, 6).Value = "Order"; IFunctionService svc = new FunctionService(); var Data = svc.GetAll(); int Row = 2; if (Data.Count > 0) { for (int i = 0; i < Data.Count; i++) { xlWorkSheet.Cell(Row + i, 1).Value = Data[i].MenuID; xlWorkSheet.Cell(Row + i, 2).Value = Data[i].ParentID; xlWorkSheet.Cell(Row + i, 3).Value = Data[i].MenuName; xlWorkSheet.Cell(Row + i, 4).Value = Data[i].Text; xlWorkSheet.Cell(Row + i, 5).Value = Data[i].Url; xlWorkSheet.Cell(Row + i, 6).Value = Data[i].OrderNumber; } xlWorkSheet.Columns().AdjustToContents(); var path = Server.MapPath("..") + "\\Master-Function.xlsx"; xlWorkBook.SaveAs(path); xlWorkBook.Dispose(); return(File(path, "application/vnd.ms-excel", "Master-Function.xlsx")); } return(RedirectToAction("Index")); } catch (Exception ex) { general.AddLogError("Function Download", ex.Message, ex.StackTrace); return(View("~/Views/Master/Function/Index.cshtml")); } }
public IActionResult GetAllFillter(string filter) { var model = _functionService.GetAll(filter); return(new ObjectResult(model)); }