示例#1
0
 public static Post GetById(int postId)
 {
     return(UoW
            .Query <Post>()
            //   .Include(p => p.Comments)
            .FirstOrDefault(p => p.Id == postId));
 }
 public static IList <FlattenedCategoryProjection> GetAll()
 {
     return(UoW
            .Query <Category>()
            .AsProjection()
            .ToList());
 }
示例#3
0
 public static PostProjectionWithComments GetById(int postId, string userId)
 {
     return(UoW
            .Query <Post>()
            .Select(p =>
                    new PostProjectionWithComments
     {
         Id = p.Id,
         Body = p.Body,
         Categories = p.Categories.Select(c => new CategoryProjection {
             Id = c.Id, Name = c.Name
         }),
         PublishDate = p.PublishDate.Value,
         Subject = p.Subject,
         Comments = p.Comments
                    .Where(c => c.Approved || c.User.UserId == userId)
                    .Select(c => new CommentProjection
         {
             Approved = c.Approved,
             Body = c.Body,
             CreationDate = c.CreationDate,
             UserEmail = c.User.Email,
             UserName = c.User.Name,
             UserWebSite = c.User.WebSite
         })
     })
            .First(p => p.Id == postId));
 }
 public static IList <CommentProjection> GetAllUnapproved()
 {
     return(UoW
            .Query <Comment>()
            .Where(c => c.Approved == false)
            .AsProjection()
            .ToList());
 }
示例#5
0
 private static IQueryable <Post> GetByDateDesc(int pageSize, int page, Expression <Func <Post, bool> > predicate)
 {
     return(UoW
            .Query <Post>()
            .Where(p => p.PublishDate != null)
            .Where(predicate)
            .OrderByDescending(p => p.PublishDate)
            .Skip(page * pageSize)
            .Take(pageSize));
 }
示例#6
0
 public static IList <PostProjection> GetLatestPosts(int pageSize, int page, string userId)
 {
     return(UoW
            .Query <Post>()
            .Where(p => p.PublishDate != null)
            .OrderByDescending(p => p.PublishDate)
            .Skip(page * pageSize)
            .Take(pageSize)
            .AsProjection(userId)
            .ToList());
 }
        public ProductionWarehouseMovementReportViewModel(
            IUnitOfWorkFactory unitOfWorkFactory,
            IInteractiveService interactiveService,
            INavigationManager navigationManager,
            IFileDialogService fileDialogService,
            IProductionWarehouseMovementReportProvider productionWarehouseMovementReportProvider)
            : base(unitOfWorkFactory ?? throw new ArgumentNullException(nameof(unitOfWorkFactory)), interactiveService, navigationManager)
        {
            _interactiveService = interactiveService ?? throw new ArgumentNullException(nameof(interactiveService));
            _fileDialogService  = fileDialogService ?? throw new ArgumentNullException(nameof(fileDialogService));
            _productionWarehouseMovementReportProvider = productionWarehouseMovementReportProvider ?? throw new ArgumentNullException(nameof(productionWarehouseMovementReportProvider));

            Title           = "Отчет по перемещениям с производств";
            UoW             = unitOfWorkFactory.CreateWithoutRoot();
            FilterWarehouse = new Warehouse()
            {
                Id = _productionWarehouseMovementReportProvider.DefaultProductionWarehouseId
            };
            WarehouseList = UoW.Query <Warehouse>().Where(x => x.TypeOfUse == WarehouseUsing.Production).List();
        }
示例#8
0
 public static Comment GetById(int commentId)
 {
     return(UoW
            .Query <Comment>()
            .FirstOrDefault(c => c.Id == commentId));
 }
 public static Category GetById(int categoryId)
 {
     return(UoW
            .Query <Category>()
            .FirstOrDefault(c => c.Id == categoryId));
 }