public async Task <ResponseAC> UpdateRoleRights(long userId, List <RoleRightsAC> roleRightsACList, string loginUserName)
        {
            ResponseAC           responseAc = new ResponseAC();
            long                 roleId     = roleRightsACList[0].RoleId;
            List <MstRolerights> roleRights = await _dbTeleBilling_V01Context.MstRolerights.Where(x => x.RoleId == roleId).Include(x => x.Role).ToListAsync();

            int     actionId = (int)EnumList.ActionTemplateTypes.Add;
            MstRole role     = new MstRole();

            role = await _dbTeleBilling_V01Context.MstRole.FindAsync(roleId);

            if (roleRights.Any())
            {
                //#region Transaction Log Entry
                //var jsonSerailzeObj = JsonConvert.SerializeObject(roleRights);
                //await _iLogManagement.SaveRequestTraseLog(Convert.ToInt64(roleRights[0].TransactionId), userId, Convert.ToInt64(EnumList.TransactionTraseLog.UpdateRecord), jsonSerailzeObj);
                //#endregion

                _dbTeleBilling_V01Context.MstRolerights.RemoveRange(roleRights);
                _dbTeleBilling_V01Context.SaveChanges();

                actionId = (int)EnumList.ActionTemplateTypes.Edit;
            }

            roleRights = new List <MstRolerights>();
            foreach (var item in roleRightsACList)
            {
                MstRolerights newRoleRights = new MstRolerights();
                newRoleRights               = _mapper.Map <MstRolerights>(item);
                newRoleRights.CreatedBy     = userId;
                newRoleRights.TransactionId = _iLogManagement.GenerateTeleBillingTransctionID();
                newRoleRights.CreatedDate   = DateTime.Now;
                roleRights.Add(newRoleRights);
            }
            await _dbTeleBilling_V01Context.MstRolerights.AddRangeAsync(roleRights);

            _dbTeleBilling_V01Context.SaveChanges();
            responseAc.Message    = _iStringConstant.RoleRightsUpdatedSuccessfully;
            responseAc.StatusCode = Convert.ToInt16(EnumList.ResponseType.Success);
            await _iLogManagement.SaveAuditActionLog((int)EnumList.AuditLogActionType.ChangeRoleRights, loginUserName, userId, "Rolerights(" + Convert.ToString(role.RoleName) + ")", actionId, null);

            return(responseAc);
        }
        public async Task <List <RoleRightsAC> > GetRoleRights(long roleId)
        {
            List <RoleRightsAC> roleRightsAC = new List <RoleRightsAC>();
            List <MstLink>      mstLinkList  = await _dbTeleBilling_V01Context.MstLink.Where(x => x.IsActive && x.ModuleId != 1).Include(x => x.Module).OrderBy(x => x.ViewIndex).ToListAsync();

            foreach (var link in mstLinkList)
            {
                RoleRightsAC  roleRights    = new RoleRightsAC();
                MstRolerights mstRoleRights = await _dbTeleBilling_V01Context.MstRolerights.FirstOrDefaultAsync(x => x.RoleId == roleId && x.LinkId == link.LinkId);

                if (mstRoleRights != null)
                {
                    roleRights = _mapper.Map <RoleRightsAC>(mstRoleRights);
                }
                roleRights.LinkId     = link.LinkId;
                roleRights.RoleId     = roleId;
                roleRights.ModuleName = link.Module.ModuleName;
                roleRights.Title      = link.Title;
                roleRightsAC.Add(roleRights);
            }
            return(roleRightsAC);
        }