Ejemplo n.º 1
0
        public virtual ActionResult List(DataSourceRequest command, IdeaListModel model)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageIdea))
            {
                return(AccessDeniedKendoGridJson());
            }

            DateTime?createOnFromValue = (model.CreatedOnFrom == null) ? null
                : (DateTime?)_dateTimeHelper.ConvertToUtcTime(model.CreatedOnFrom.Value, _dateTimeHelper.CurrentTimeZone);
            DateTime?createOnToValue = (model.CreatedOnTo == null) ? null
                : (DateTime?)_dateTimeHelper.ConvertToUtcTime(model.CreatedOnTo.Value, _dateTimeHelper.CurrentTimeZone);

            var ideas = _ideaService.GetAllIdeas(null, createOnFromValue, createOnToValue, command.Page - 1,
                                                 command.PageSize);

            var gridModel = new DataSourceResult
            {
                Data = ideas.Select(idea => new IdeaModel
                {
                    Id            = idea.Id,
                    Guid          = idea.Guid,
                    Private       = idea.Private,
                    Deleted       = idea.Deleted,
                    Body          = idea.Body,
                    CustomerEmail = idea.Customer != null ? idea.Customer.Email : null,
                    CreatedOn     = _dateTimeHelper.ConvertToUserTime(idea.CreatedOnUtc, DateTimeKind.Utc),
                    UpdatedOn     = idea.UpdatedOnUtc.HasValue
                        ? (DateTime?)_dateTimeHelper.ConvertToUserTime(idea.UpdatedOnUtc.Value, DateTimeKind.Utc)
                        : null
                }),
                Total = ideas.TotalCount
            };

            return(Json(gridModel));
        }
Ejemplo n.º 2
0
        public virtual ActionResult ListIdea(DataSourceRequest command, int customerId)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageCustomers))
            {
                return(AccessDeniedKendoGridJson());
            }

            var customerIds = new[] { customerId };
            var ideas       = _ideaService.GetAllIdeas(customerIds, null, null, command.Page - 1, command.PageSize);

            var gridModel = new DataSourceResult
            {
                Data = ideas.Select(x =>
                {
                    var ideaModel = new CustomerModel.IdeaModel
                    {
                        Id        = x.Id,
                        Body      = x.Body,
                        CreatedOn = _dateTimeHelper.ConvertToUserTime(x.CreatedOnUtc, DateTimeKind.Utc),
                        UpdatedOn = x.UpdatedOnUtc.HasValue ?
                                    (DateTime?)_dateTimeHelper.ConvertToUserTime(x.UpdatedOnUtc.Value, DateTimeKind.Utc)
                            : null,
                        Deleted = x.Deleted,
                        Private = x.Private
                    };
                    return(ideaModel);
                }),
                Total = ideas.TotalCount
            };

            return(Json(gridModel));
        }
Ejemplo n.º 3
0
 public IEnumerable <Idea> Get()
 {
     return(_ideaService.GetAllIdeas());
 }