public async Task <int> SaveModuleAccessPage(ModuleAccessPage userAccessPage)
        {
            try
            {
                if (userAccessPage.Id != 0)
                {
                    userAccessPage.updatedBy = userAccessPage.createdBy;
                    userAccessPage.updatedAt = DateTime.Now;
                    _context.ModuleAccessPages.Update(userAccessPage);
                }
                else
                {
                    userAccessPage.createdAt = DateTime.Now;
                    _context.ModuleAccessPages.Add(userAccessPage);
                }

                await _context.SaveChangesAsync();

                return(userAccessPage.Id);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public async Task <JsonResult> SaveUserModuleAccess(string UserTypeIds, int[] AllMenuIds)
        {
            await moduleAssignService.DeleteModuleAccesspageByUserTypeId(UserTypeIds);

            foreach (var app in AllMenuIds)
            {
                ModuleAccessPage UAP = new ModuleAccessPage();
                UAP.Id = 0;
                UAP.applicationRoleId = UserTypeIds;

                UAP.inventoryModuleId = Convert.ToInt32(app);

                await moduleAssignService.SaveModuleAccessPage(UAP);

                UAP = new ModuleAccessPage();
            }


            return(Json(new { result = "1" }));
        }