Notes![what is notes.io? What is notes.io?](/theme/images/whatisnotesio.png)
![]() ![]() Notes - notes.io |
{
using var context = new CRMContext();
var salesDepartmentId = context.Departments.FirstOrDefault(d => d.Name == "Sales")?.Id;
var creditDepartmentId = context.Departments.FirstOrDefault(d => d.Name == "Credit")?.Id;
var salesLeadsQuery =
from lead in context.Leads
join salesStage in context.SalesStages on lead.SalesStageId equals salesStage.Id into salesStages
from salesStage in salesStages.DefaultIfEmpty()
join creditStage in context.CreditStages on lead.CreditStageId equals creditStage.Id into creditStages
from creditStage in creditStages.DefaultIfEmpty()
join source in context.Sources on lead.SourceId equals source.Id into sources
from source in sources.DefaultIfEmpty()
join userSale in context.Users on lead.AssignedSalesId equals userSale.Id into users
from userSale in users.DefaultIfEmpty()
join dep in context.Departments on lead.DepartmentId equals dep.Id into departaments
from dep in departaments.DefaultIfEmpty()
where lead.DepartmentId == salesDepartmentId || lead.DepartmentId == creditDepartmentId
orderby lead.CreatedAt descending
select new LeadViewModel
{
// Include the properties you need
Id = lead.Id,
FirstName = lead.FirstName,
LastName = lead.LastName,
FatherName = lead.FatherName,
Source = lead.Source.Name,
LastUpdatedAt = lead.LastUpdatedAt,
CreatedAt = lead.CreatedAt,
IsReadBySales = lead.IsReadBySales,
AssignedUserFullName = $"{lead.AssignedSales.FirstName} {lead.AssignedSales.LastName}",
Stage = lead.Department.Name.ToLower() == "credit" && (lead.IsReadByCreditor == true && lead.CreditStage != null)
? lead.CreditStage.Name : lead.SalesStage.Name,
SalesStageId = lead.SalesStageId,
SalesStageName = lead.SalesStage.Name,
LeadPhones = context.LeadPhones
.Where(lp => lp.LeadId == lead.Id)
.Select(lp => new LeadPhoneViewModel
{
// Include the properties you need for LeadPhoneViewModel
Phone = lp.PhoneNumber,
// Other properties...
})
.ToList(),
DepartamentName = lead.Department.Name,
AssignedSalesId = lead.AssignedSalesId
};
var salesLeads = salesLeadsQuery.Where(specification).Skip(page*pageCount).Take(pageCount).ToList();
return salesLeads;
}
List<LeadViewModel> FindSalesLeads(Func<LeadViewModel, bool> specification , int page , int pageCount);
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team