Esempio n. 1
0
        public async Task <ActionResult <IEnumerable <CV_DM_DefaultTask> > > r1GetListWorks()
        {
            RequestToken token = CommonData.GetDataFromToken(User);
            var          user  = await _context.Sys_Dm_User.FindAsync(token.UserID);

            int DepartmentId = await WorksCommon.getDepartmentID(_context, user.DepartmentId ?? 0);

            var tables = from a in _context.CV_DM_DefaultTask
                         join b in _context.CV_DM_GroupTask on a.GroupTaskId equals b.Id
                         where a.DepartmentId == DepartmentId
                         select new
            {
                a.Name,
                a.Id,
            };

            return(new ObjectResult(new { error = 0, data = await tables.OrderBy(x => x.Id).ToListAsync() }));
        }
Esempio n. 2
0
        public async Task <ActionResult <IEnumerable <CV_DM_DefaultTask> > > r1GetListWorks()
        {
            var userId = Convert.ToInt32(User.Claims.First(c => c.Type == "UserId").Value);
            var user   = await _context.Sys_Dm_User.FindAsync(userId);

            int DepartmentId = await WorksCommon.getDepartmentID(_context, user.DepartmentId ?? 0);

            var tables = from a in _context.CV_DM_DefaultTask
                         join b in _context.CV_DM_GroupTask on a.GroupTaskId equals b.Id
                         where a.DepartmentId == DepartmentId
                         select new
            {
                a.Name,
                a.Id,
            };

            return(new ObjectResult(new { error = 0, data = await tables.OrderBy(x => x.Id).ToListAsync() }));
        }