public PartyDto GetPartyById(GetPartyByIdDto dto) { return(ctx.Parties. Where(p => p.Id == dto.Id.ToGuid()). Include(p => p.StoreCategories).ThenInclude(p => p.StoreCategory). Include(p => p.StoreImages).ThenInclude(p => p.Document). Include(p => p.User). Select(p => DtoBuilder.CreatePartyDto(p)). FirstOrDefault()); }
public List <PartyDto> GetPartiesByPage(GetPartiesByPageDto dto) { return(ctx.Parties. Skip((dto.PageNo - 1) * AdminSettings.Block). Take(AdminSettings.Block). Where(p => dto.UserId == null || p.UserId == dto.UserId). Include(p => p.StoreCategories).ThenInclude(p => p.StoreCategory). Include(p => p.StoreImages).ThenInclude(p => p.Document). Where(p => dto.Keyword == null || dto.Keyword == "" || p.StoreName.Contains(dto.Keyword) || p.ContractNumber.Contains(dto.Keyword) || p.StoreAddress.Contains(dto.Keyword) || p.StoreNumber.Contains(dto.Keyword) ). Include(p => p.User). Select(p => DtoBuilder.CreatePartyDto(p)). ToList()); }