예제 #1
0
        public async Task <ActionResult <IEnumerable <VB_QT_Buoc> > > r1GetListDataLenhTheoUser(LenhMenuForUser options)
        {
            try
            {
                var userId = Convert.ToInt32(User.Claims.First(c => c.Type == "UserId").Value);
                var user   = await _context.Sys_Dm_User.FindAsync(userId);

                var tables = from a in _context.VB_QT_BuocLenhGroupRole
                             where a != null
                             join b in _context.VB_QT_BuocLenhTuongTac on a.BuocLenhTuongTacId equals b.Id
                             join c in _context.VB_QT_LenhTuongTac on b.LenhTuongTacId equals c.Id
                             join d in _context.VB_QT_Buoc on b.BuocId equals d.Id
                             where a.GroupRoleId == options.GroupRoleId && d.MenuId == options.MenuId
                             select new
                {
                    c.Name,
                    BuocLenhGroupId = a.Id,
                    c.IsActive,
                    c.IsOrder,
                    c.Code
                };
                var qrs = await tables.OrderBy(x => x.IsOrder).ToListAsync();

                return(new ObjectResult(new { error = 0, data = qrs }));
            }
            catch (Exception)
            {
                return(new ObjectResult(new { error = 1 }));
            }
        }
예제 #2
0
        public async Task <ActionResult <IEnumerable <VB_QT_Buoc> > > r1GetListDataLenhTheoUser(LenhMenuForUser options)
        {
            try
            {
                RequestToken token = CommonData.GetDataFromToken(User);
                var          user  = await _context.Sys_Dm_User.FindAsync(token.UserID);

                var tables = from a in _context.VB_QT_BuocLenhGroupRole
                             where a != null
                             join b in _context.VB_QT_BuocLenhTuongTac on a.BuocLenhTuongTacId equals b.Id
                             join c in _context.VB_QT_LenhTuongTac on b.LenhTuongTacId equals c.Id
                             join d in _context.VB_QT_Buoc on b.BuocId equals d.Id
                             where a.GroupRoleId == options.GroupRoleId && d.MenuId == options.MenuId
                             select new
                {
                    c.Name,
                    BuocLenhGroupId = a.Id,
                    c.IsActive,
                    c.IsOrder,
                    c.Code
                };
                var qrs = await tables.OrderBy(x => x.IsOrder).ToListAsync();

                return(new ObjectResult(new { error = 0, data = qrs }));
            }
            catch (Exception)
            {
                return(new ObjectResult(new { error = 1 }));
            }
        }