Exemple #1
0
        public async Task <IActionResult> GetEntries(
            [FromRoute] Guid organizationId,
            [FromQuery] TimeMatrixFilters filters
            )
        {
            var segments = await _timeEntryService
                           .GetTimeEntries <AccountManagerTimeEntryOutput>(_am, filters);

            AddPagination(filters, segments.Total);
            return(Ok(segments.Data));
        }
        public IEnumerable <TimeEntryViewModel> GetAllEntriesForProject(long id)
        {
            List <TimeEntryViewModel> timeEntries = new List <TimeEntryViewModel>();

            timeEntryService.GetTimeEntries(id).ToList().ForEach(t => {
                TimeEntryViewModel timeEntry = new TimeEntryViewModel {
                    Id            = t.Id,
                    MinutesWorked = t.MinutesWorked,
                    ProjectId     = t.ProjectId
                };
                timeEntries.Add(timeEntry);
            });
            return(timeEntries);
        }
Exemple #3
0
        public async Task <IHttpActionResult> Get()
        {
            var queryString = HttpContext.Current.Request.QueryString;

            var rawQueryString = HttpUtility.UrlDecode(Request.RequestUri.Query);
            var orderBy        = queryString["$orderby"];

            var query = new GetTimeEntryQuery()
            {
                IncludeAllUsers = false,
                OrderBy         = orderBy,
                QueryString     = rawQueryString
            };

            var pageSize = queryString["$top"];
            int pageSizeInt;

            if (int.TryParse(pageSize, out pageSizeInt))
            {
                query.PageSize = pageSizeInt;
            }

            try
            {
                var timeEntries = await timeEntryService.GetTimeEntries(query);

                return(Ok(timeEntries));
            }
            catch (ValidationException ex)
            {
                return(BadRequest(ex.Message));
            }
            catch (AuthorizationException)
            {
                return(this.StatusCode(System.Net.HttpStatusCode.Forbidden));
            }
        }
Exemple #4
0
 public IEnumerable <TimeEntry> Get()
 {
     return(timeEntryService.GetTimeEntries());
 }