Пример #1
0
 public IActionResult GetUser([FromBody] PageDto pageDto)
 {
     try
     {
         GetPageDto <List <UserDto> > returnData = new GetPageDto <List <UserDto> >();
         returnData.TotalCount = _context.User.Count();
         if (pageDto.Page >= 1 && pageDto.Number > 0)
         {
             var UserList = (from b in _context.User
                             select new UserDto()
             {
                 Ip = b.Ip,
                 Name = WebUtility.UrlDecode(b.Name),
                 Avatar = b.Avatar,
                 OpenId = b.OpenId,
                 CreatDate = b.CreatDate,
                 UpDate = b.UpDate
             }).OrderByDescending(d => d.CreatDate).Skip((pageDto.Page - 1) * pageDto.Number).Take(pageDto.Number).AsNoTracking().ToList();
             returnData.BigField = UserList;
         }
         return(new ObjectResult(returnData));
     }
     catch (Exception ex)
     {
         return(StatusCode(500, ex.Message));
     }
 }
Пример #2
0
        public IActionResult GetKind([FromBody] PageDto pageDto)
        {
            try
            {
                var id = pageDto.Cid;
                GetPageDto <List <GoodsBigKindDto> > returnData = new GetPageDto <List <GoodsBigKindDto> >();
                if (id == 1)
                {
                    returnData.TotalCount = _context.GoodsBigKinds.Count();
                    if (pageDto.Page >= 1 && pageDto.Number > 0)
                    {
                        var GoodsKindList = (from c in _context.GoodsBigKinds
                                             select new GoodsBigKindDto()
                        {
                            Name = c.Name,
                            Index = c.Index,
                            SysUserId = c.SysUserId,
                            SysUserName = c.SysUsers.Name,
                            GoodsBigKindId = c.GoodsBigKindId,
                            Img = c.Img
                        }).OrderBy(d => d.Index).Skip((pageDto.Page - 1) * pageDto.Number).Take(pageDto.Number).AsNoTracking().ToList();
                        returnData.BigField = GoodsKindList;
                    }
                }
                else
                {
                    returnData.TotalCount = _context.GoodsBigKinds.Where(x => x.SysUserId == id).Count();
                    if (pageDto.Page >= 1 && pageDto.Number > 0)
                    {
                        var GoodsKindList = (from c in _context.GoodsBigKinds
                                             where c.SysUserId == id
                                             select new GoodsBigKindDto()
                        {
                            Name = c.Name,
                            Index = c.Index,
                            SysUserId = c.SysUserId,
                            GoodsBigKindId = c.GoodsBigKindId,
                            Img = c.Img
                        }).OrderBy(d => d.Index).Skip((pageDto.Page - 1) * pageDto.Number).Take(pageDto.Number).AsNoTracking().ToList();
                        returnData.BigField = GoodsKindList;
                    }
                }

                return(new ObjectResult(returnData));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex.Message));
            }
        }
Пример #3
0
        public IActionResult GetLottery([FromBody] PageDto pageDto)
        {
            try
            {
                GetPageDto <List <LotteryDto> > returnData = new GetPageDto <List <LotteryDto> >();
                if (pageDto.Cid == 1)
                {
                    returnData.TotalCount = _context.Lotterys.Count();
                    if (pageDto.Page >= 1 && pageDto.Number > 0)
                    {
                        var LotteryList = (from b in _context.Lotterys
                                           select new LotteryDto()
                        {
                            Id = b.Id,
                            Name = b.Name,
                            Probability = b.Probability,
                            CreatDate = b.CreatDate,
                            EditDate = b.EditDate
                        }).OrderByDescending(d => d.Id).Skip((pageDto.Page - 1) * pageDto.Number).Take(pageDto.Number).AsNoTracking().ToList();
                        returnData.BigField = LotteryList;
                    }
                }
                else
                {
                    returnData.TotalCount = _context.Lotterys.Where(x => x.SysUserId == pageDto.Cid).Count();
                    if (pageDto.Page >= 1 && pageDto.Number > 0)
                    {
                        var LotteryList = (from b in _context.Lotterys
                                           where b.SysUserId == pageDto.Cid
                                           select new LotteryDto()
                        {
                            Id = b.Id,
                            Name = b.Name,
                            Probability = b.Probability,
                            CreatDate = b.CreatDate,
                            EditDate = b.EditDate
                        }).OrderByDescending(d => d.Id).Skip((pageDto.Page - 1) * pageDto.Number).Take(pageDto.Number).AsNoTracking().ToList();
                        returnData.BigField = LotteryList;
                    }
                }

                return(new ObjectResult(returnData));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex.Message));
            }
        }
Пример #4
0
        public IActionResult GetAppOrder([FromBody] PageDto pageDto)
        {
            GetPageDto <List <OrderDto> > returnData = new GetPageDto <List <OrderDto> >();

            returnData.TotalCount = _context.Orders.Where(x => x.SysUserId == pageDto.Cid).Count();
            if (pageDto.Page >= 1)
            {
                var OrderList = (from a in _context.Orders
                                 where a.SysUserId == pageDto.Cid
                                 from b in _context.Addresss
                                 where a.AddressId == b.AddressId
                                 select new OrderDto()
                {
                    OrderId = a.OrderId,
                    OrderNo = a.OrderNo,
                    Price = a.Price,
                    PayType = a.PayType,
                    PayState = a.PayState,
                    PayTypestr = a.PayState.ToString(),
                    CreatDate = a.CreatDate,
                    CreatDatestr = a.CreatDate.ToString("yyyy-MM-dd HH:mm:ss"),
                    UserId = a.UserId,
                    Addr = b.Addr,
                    ContactName = b.ContactName,
                    ContactPhone = b.ContactPhone,
                    GodDtos = (from d in _context.OrderGoods
                               where d.OrderId == a.OrderId
                               from e in _context.Goodss
                               where e.GoodsId == d.GoodsId
                               select new GodDto()
                    {
                        GodImg = e.Img,
                        GodName = e.Name,
                        NewPrice = e.NewPrice,
                        Num = d.Num
                    }).ToList()
                }).OrderByDescending(d => d.CreatDate).Skip((pageDto.Page - 1) * 15).Take(15).ToList();
                returnData.BigField = OrderList;
            }
            return(Ok(returnData));
        }
Пример #5
0
 public IActionResult GetSysUsers([FromBody] PageDto pageDto)
 {
     try
     {
         GetPageDto <List <SysUserDto> > returnData = new GetPageDto <List <SysUserDto> >();
         returnData.TotalCount = _context.SysUsers.Count();
         if (pageDto.Page >= 1 && pageDto.Number > 0)
         {
             var sysuserList = (from a in _context.SysUsers
                                where a.SysUserId != 1
                                select new SysUserDto()
             {
                 SysUserId = a.SysUserId,
                 Account = a.Account,
                 Addr = a.Addr,
                 Comments = a.Comments,
                 CreatDate = a.CreatDate,
                 Ip = a.Ip,
                 Name = a.Name,
                 Phone = a.Phone,
                 Longitude = a.Longitude,
                 Latitude = a.Latitude,
                 Popenid = a.Popenid,
                 Comment1 = a.Comment1,
                 Price = a.Price,
                 TemIdAccept = a.TemIdAccept,
                 TemIdRefuse = a.TemIdRefuse,
                 TemIdOrder = a.TemIdOrder,
                 TemIdSend = a.TemIdSend,
                 IsOpen = a.IsOpen
             }).OrderBy(d => d.SysUserId).Skip((pageDto.Page - 1) * pageDto.Number).Take(pageDto.Number).AsNoTracking().ToList();
             returnData.BigField = sysuserList;
         }
         return(new ObjectResult(returnData));
     }
     catch (Exception ex)
     {
         return(StatusCode(500, ex.Message));
     }
 }
Пример #6
0
        public IActionResult SearchAllGoods([FromBody] PageDto pageDto)
        {
            try
            {
                var id     = pageDto.Cid;
                var GoodId = pageDto.GoodsKindId;
                GetPageDto <List <GoodsDto> > returnData = new GetPageDto <List <GoodsDto> >();
                returnData.TotalCount = _context.Goodss.Where(x => x.SysUserId == id && x.Name.Contains(pageDto.SearchName)).Count();
                if (pageDto.Page >= 1 && pageDto.Number > 0)
                {
                    var GoodsList = (from d in _context.Goodss
                                     where d.SysUserId == id && d.Name.Contains(pageDto.SearchName)
                                     select new GoodsDto()
                    {
                        Name = d.Name,
                        SysUserId = d.SysUserId,
                        GoodsId = d.GoodsId,
                        GoodsKindId = d.GoodsKindId,
                        GoodsBigKindId = d.GoodsKinds.GoodsBigKindId,
                        Img = d.Img,
                        NewPrice = d.NewPrice,
                        OldPrice = d.OldPrice,
                        Notice = d.Notice,
                        Comment1 = d.Comment1,
                        CreatDate = d.CreatDate
                    }).OrderBy(d => d.GoodsId).Skip((pageDto.Page - 1) * pageDto.Number).Take(pageDto.Number).AsNoTracking().ToList();
                    returnData.BigField = GoodsList;
                }

                return(new ObjectResult(returnData));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex.Message));
            }
        }
Пример #7
0
 public IActionResult GetAllOrder([FromBody] PageDto pageDto)
 {
     try
     {
         var id = pageDto.Cid;
         GetPageDto <List <OrderDto> > returnData = new GetPageDto <List <OrderDto> >();
         if (id == 1)
         {
             returnData.TotalCount = _context.Orders.Count();
             if (pageDto.Page >= 1 && pageDto.Number > 0)
             {
                 var OrderList = (from c in _context.Orders
                                  select new OrderDto()
                 {
                     OrderId = c.OrderId,
                     Name = c.Name,
                     SysUserId = c.SysUserId,
                     SysUserName = c.SysUsers.Name,
                     OrderNo = c.OrderNo,
                     Price = c.Price,
                     PayType = c.PayType,
                     PayState = c.PayState,
                     CreatDate = c.CreatDate,
                     UserId = c.UserId,
                     AddressId = c.AddressId,
                     OpenId = c.Users.OpenId,
                     UserName = WebUtility.UrlDecode(c.Users.Name),
                 }).OrderByDescending(d => d.CreatDate).Skip((pageDto.Page - 1) * pageDto.Number).Take(pageDto.Number).AsNoTracking().ToList();
                 returnData.BigField = OrderList;
             }
         }
         else
         {
             returnData.TotalCount = _context.Orders.Where(x => x.SysUserId == id).Count();
             if (pageDto.Page >= 1 && pageDto.Number > 0)
             {
                 var OrderList = (from c in _context.Orders
                                  where c.SysUserId == id
                                  select new OrderDto()
                 {
                     OrderId = c.OrderId,
                     Name = c.Name,
                     SysUserId = c.SysUserId,
                     OrderNo = c.OrderNo,
                     Price = c.Price,
                     PayType = c.PayType,
                     PayState = c.PayState,
                     CreatDate = c.CreatDate,
                     UserId = c.UserId,
                     OpenId = c.Users.OpenId,
                     AddressId = c.AddressId,
                     UserName = WebUtility.UrlDecode(c.Users.Name),
                 }).OrderByDescending(d => d.CreatDate).Skip((pageDto.Page - 1) * pageDto.Number).Take(pageDto.Number).AsNoTracking().ToList();
                 returnData.BigField = OrderList;
             }
         }
         return(new ObjectResult(returnData));
     }
     catch (Exception ex)
     {
         return(StatusCode(500, ex.Message));
     }
 }