public AwardMixedDTO(AwardMixedDTO award) { AwardId = award.AwardId; CategoryTitle = award.CategoryTitle; FestivalId = award.FestivalId; PlayTitle = award.PlayTitle; }
public AwardWindow(AwardDataDTO awardData, AwardMixedDTO award, ObservableCollection<CategoryDTO> categoriesList) { AEViewModel = new AwardEditViewModel(categoriesList){OriginalAward = awardData, MixedDTO = award}; InitializeComponent(); }
public ListResponse<AwardMixedDTO> SearchAwards(AwardsSearchingCriteria criteria, int pageNr, int pageAmount) { using (var context = new AF_Context()) { try { var skip = pageAmount*(pageNr - 1); var query = (from a in context.Awards select a).Include(a => a.Play).Include(a => a.Category); if (criteria.FestivalIdFilter != null) query = query.Where(a => a.Play.FestivalId == criteria.FestivalIdFilter); if (!String.IsNullOrEmpty(criteria.Author)) query = query.Where(a => a.Play.Author.Contains(criteria.Author)); if (!String.IsNullOrEmpty(criteria.Title)) query = query.Where(a => a.Play.Title.Contains(criteria.Title)); if (criteria.CategoryIdFilter != null) query = query.Where(a => a.CategoryId == criteria.CategoryIdFilter); List<AwardMixedDTO> tmp = new List<AwardMixedDTO>(); //List<AwardDataDTO> tmp; foreach (Award b in (query.OrderBy(a => a.Play.FestivalId) .ThenBy(a => a.Category.Group) .ThenBy(a => a.Category.Order) .Skip(skip) .Take(pageAmount))) { var newAwardDto = new AwardMixedDTO() { AwardId = b.AwardId, FestivalId = b.Play.FestivalId, CategoryTitle = b.Category.Title, PlayTitle = b.Play.Title, }; tmp.Add(newAwardDto); } return (new ListResponse<AwardMixedDTO>(tmp)); } catch (Exception ex) { throw; } } }