Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var model = await db.Users.Where(u => u.Id == id).Select(p => new ProfilePictureServiceModel
- {
- Id = p.Pictures
- .Where(pp => pp.isProfilePicture == true)
- .Select(i => i.PictureId).FirstOrDefault(),
- PictureByteArray = p.Pictures
- .Where(pp => pp.isProfilePicture == true)
- .Select(cpp => cpp.PictureByteArray)
- .FirstOrDefault(),
- allPage = (p.Pictures.Count() - 1) % ServicesDataConstraints.EditProfilePictureServicePageSize == 0 ? ((p.Pictures.Count() - 1) / ServicesDataConstraints.EditProfilePictureServicePageSize) : (((p.Pictures.Count() - 1) / ServicesDataConstraints.EditProfilePictureServicePageSize) + 1),
- Pictures = p.Pictures
- .Where(f => f.isProfilePicture == false)
- .OrderByDescending(o => o.PictureId)
- .Skip((page - 1) * ServicesDataConstraints.EditProfilePictureServicePageSize)
- .Take(ServicesDataConstraints.EditProfilePictureServicePageSize)
- .Select(k =>
- new ChildPicturesServiceModel
- {
- PictureByteArray = k.PictureByteArray,
- Id = k.PictureId,
- })
- .ToList()
- }).FirstOrDefaultAsync();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement