예제 #1
0
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,ModuleId,Uiname,Url,IsActive,IsOpen,CreatedOn,CreatedBy,UpdatedOn,UpdatedBy")] ModuleUi moduleUi)
        {
            if (id != moduleUi.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(moduleUi);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ModuleUiExists(moduleUi.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(moduleUi));
        }
        public IActionResult Index(string currentUrl)
        {
            string   userId   = "1"; // Get UserID from IIdentity
            ModuleUi moduleUI = _context.ModuleUi.FirstOrDefault(x => x.Url == currentUrl);

            if (moduleUI.IsOpen)
            {
                return(Json(new { IsOpen = true, data = "", IsPermitted = true }));
            }

            UserModuleUi userModuleUI = _context.UserModuleUi.FirstOrDefault(x => x.ModuleUiid == moduleUI.Id);

            if (userModuleUI == null)
            {
                return(Json(new { IsOpen = true, data = "", IsPermitted = false }));
            }

            if (userModuleUI.HasFullAccess)
            {
                return(Json(new { IsOpen = true, data = "", IsPermitted = true }));
            }

            List <UserModuleUicontrolsPermissions> permittedItems = _context.UserModuleUicontrolsPermissions.Where(x => x.ModuleUiid == moduleUI.Id && x.UserId == userId).ToList();

            return(Json(new { IsOpen = moduleUI.IsOpen, data = permittedItems, IsPermitted = true }));
        }
예제 #3
0
        public async Task <IActionResult> DeleteConfirmed(Guid id)
        {
            ModuleUi moduleUi = await _context.ModuleUi.FindAsync(id);

            _context.ModuleUi.Remove(moduleUi);
            await _context.SaveChangesAsync();

            return(RedirectToAction(nameof(Index)));
        }
예제 #4
0
        public async Task <IActionResult> Create([Bind("Id,ModuleId,Uiname,Url,IsActive,IsOpen,CreatedOn,CreatedBy,UpdatedOn,UpdatedBy")] ModuleUi moduleUi)
        {
            if (ModelState.IsValid)
            {
                moduleUi.Id = Guid.NewGuid();
                _context.Add(moduleUi);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(moduleUi));
        }
예제 #5
0
        // GET: ModuleUis/Edit/5
        public async Task <IActionResult> Edit(Guid?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            ModuleUi moduleUi = await _context.ModuleUi.FindAsync(id);

            if (moduleUi == null)
            {
                return(NotFound());
            }
            return(View(moduleUi));
        }
예제 #6
0
        // GET: ModuleUis/Details/5
        public async Task <IActionResult> Details(Guid?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            ModuleUi moduleUi = await _context.ModuleUi
                                .FirstOrDefaultAsync(m => m.Id == id);

            if (moduleUi == null)
            {
                return(NotFound());
            }

            return(View(moduleUi));
        }