Пример #1
0
 public static SearchResultViewModel Create(ActivityQuery query, Page<Activity> actions)
 {
     return new SearchResultViewModel
                {
                    SortOptions = new GridSortOptions
                                      {
                                          Column = query.SortColumn,
                                          Direction = (MvcContrib.Sorting.SortDirection)query.SortDirection
                                      },
                    Items = SearchResultItemViewModel.Create(actions)
                };
 }
Пример #2
0
 private static List<SelectListItem> MapStatuses(ActivityQuery a)
 {
     var selectedValue = a.FailureDeterminedBy == null ? String.Empty : a.FailureDeterminedBy.ToString();
     return Enum.GetNames(typeof (FailureDeterminedBy)).ToSelectList(selectedValue);
 }
Пример #3
0
 private static SelectListItem Create(ActivityQuery query, Application x)
 {
     return new SelectListItem
                {
                    Selected = query.ApplicationId != null && x.Id == query.ApplicationId,
                    Text = x.Name,
                    Value = x.Id
                };
 }
Пример #4
0
 public ActivityQuery UpdateQuery(ActivityQuery query)
 {
     return Mapper.Map(this, query);
 }
Пример #5
0
 public static ActivitiesViewModel Create(ActivityQuery query, IOrderedEnumerable<Application> applications)
 {
     var model = Mapper.Map<ActivitiesViewModel>(query);
     var list = new List<SelectListItem>
                    {
                        new SelectListItem
                            {
                                Selected = query.ApplicationId == null,
                                Text = String.Empty,
                                Value = null
                            }
                    };
     list.AddRange(applications.Select(x => Create(query, x)));
     model.Applications = list;
     return model;
 }
Пример #6
0
        private PartialViewResult Search(ActivityQuery query)
        {
            var actions = Context.Activities.Search(query);
            var model = SearchResultViewModel.Create(query, actions);

            return PartialView(MVC.Activities.ActionNames.Search, model);
        }