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)); }
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)); }
public IEnumerable <Idea> Get() { return(_ideaService.GetAllIdeas()); }