private ProjectModel PrepareListProjectModel(Project project)
        {
            var model = project.ToModel();

            model.Actions.Add(new ModelActionLink
            {
                Alt = "Edit",
                Icon = Url.Content("~/Areas/Admin/Content/images/icon-edit.png"),
                Target = Url.Action("edit", new { id = project.Id })
            });

            model.Actions.Add(new DeleteActionLink(project.Id, Search, Page));

            return model;
        }
        private ProjectModel PrepareProjectModel(Project project, int moderationId = 0)
        {
            var model = new ProjectModel();
            if (project != null)
                model = project.ToModel();

            model.AvailableRecurrenceIntervals = _webHelper.GetAllEnumListItems<RecurrenceInterval>();
            model.AvailableDisclosureLevels = _webHelper.GetAllEnumListItems<DisclosureLevel>();
            model.AvailableStatus = _webHelper.GetAllEnumListItems<ProjectStatus>();
            model.AvailableUsers = _userService.GetAllUsers(true).Select(x => x.ToModel()).ToList();
            model.AvailableCategories = _categoryService.GetAllCategories(0, -1, true).Select(x => x.ToModel()).ToList();
            model.ModerationId = moderationId;

            if (model.CreatedById != null)
                model.CreatedBy = _userService.GetUserById((int) model.CreatedById).ToModel();

            var selectCategories = model.AvailableCategories.Where(category => (model.Categories.Any(x => x.Id == category.Id)));
            selectCategories.ToList().ForEach(x => x.IsChecked = true);

            return model;
        }
        private ProjectDetailModel PrepareProjectDetailModel(Project project, bool prepareComments = true)
        {
            if (project == null)
                throw new ArgumentNullException("project");

            var model = new ProjectDetailModel
            {
                CurrentUser = _workContext.CurrentUser.ToModel(),
                Project = project.ToModel()
            };

            if (prepareComments)
            {
                var comments = project.Comments.OrderBy(x => x.CreatedDate);
                foreach (var comment in comments)
                    model.Project.Comments.Add(comment.ToModel());
            }

            foreach (var complaintType in _moderationQueueService.GetAllCommentComplaintTypes())
                model.CommentComplaintTypes.Add(new SelectListItem { Text = complaintType.Value, Value = complaintType.Key.ToString() });

            foreach (var complaintType in _moderationQueueService.GetAllProjectComplaintTypes())
                model.ProjectComplaintTypes.Add(new SelectListItem { Text = complaintType.Value, Value = complaintType.Key.ToString() });

            string descriptionDate = "";
            if (model.Project.StartDate != null)
            {
                string descriptionTime = _webHelper.DateTimeFormat("H:mmTT", model.Project.StartDate.Value);
                if (model.Project.EndDate != null && model.Project.EndDate.Value.Subtract(model.Project.StartDate.Value).Days < 1)
                    descriptionTime += " to " + _webHelper.DateTimeFormat("H:mmTT", model.Project.EndDate.Value);
                descriptionDate = string.Format(" on {0} from {1}", _webHelper.DateTimeFormat("d~ MMMM", model.Project.StartDate.Value), descriptionTime);
            }

            model.MetaTitle = model.Project.Name + " - #WeWillGather";
            model.MetaDescription = string.Format("Volunteer now and join the '{0}' project taking place{1}. Organised with #WeWillGather.", model.Project.Name, descriptionDate);

            return model;
        }