private static List <CeremonyGuestQueryModel> MapCeremonyGuests(List <CeremonyGuest> ceremonyGuests) { return(ceremonyGuests.Select(x => new CeremonyGuestQueryModel { Id = x.Id, CeremonyId = x.CeremonyId, GuestId = x.GuestId, Guest = x.Guest.FullName, GuestType = GuestTypes.GetGuestType(x.Guest.GuestType) }).ToList()); }
public List <GuestViewModel> Search(GuestSearchModel searchModel) { var query = _hContext.Guests.Select(x => new GuestViewModel { Id = x.Id, FullName = x.FullName, Tel = x.Tel, GuestType = GuestTypes.GetGuestType(x.GuestType), Image = x.Image, Coordinator = x.Coordinator }); if (!string.IsNullOrWhiteSpace(searchModel.FullName)) { query = query.Where(x => x.FullName.Contains(searchModel.FullName)); } return(query.OrderByDescending(x => x.Id).ToList()); }
public List <GuestViewModel> GetGuests(long id = 0) { var guestInfo = _hContext.Guests.Select(x => new GuestViewModel { Id = x.Id, GuestType = GuestTypes.GetGuestType(x.GuestType), FullName = x.FullName, Image = x.Image, Tel = x.Tel, Email = x.Email, Coordinator = x.Coordinator }); if (id != 0) { guestInfo = guestInfo.Where(x => x.Id == id); } return(guestInfo.ToList()); }
private static List <CeremonyGuestViewModel> MapGuests(List <CeremonyGuest> ceremonyGuests) { var guests = new List <CeremonyGuestViewModel>(); foreach (var item in ceremonyGuests) { var gst = new CeremonyGuestViewModel { Id = item.CeremonyId, CeremonyId = item.CeremonyId, GuestId = item.GuestId, GuestType = GuestTypes.GetGuestType(item.Guest.GuestType), Guest = item.Guest.FullName, GuestPic = item.Guest.Image, Satisfication = item.Satisfication }; guests.Add(gst); } return(guests); }