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()); }
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()); }
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)); }
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(); }
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)); }