Beispiel #1
0
        public async Task <IActionResult> GetDates([FromBody] DateViewModel request)
        {
            BaseResult <List <DateListViewModel> > response = new BaseResult <List <DateListViewModel> >();

            if (request == null)
            {
                response.IsError = true;
                response.Message = coreHelper.Constants.ErrorMessage.EmptyModel;
                return(BadRequest(response));
            }
            var dates = await iAllocations.GetDates(request);

            if (dates.Message != null && dates.IsError)
            {
                return(BadRequest(dates));
            }
            if (dates.IsError && dates.ExceptionMessage != null)
            {
                return(StatusCode(500, dates));
            }
            if (dates.Result == null || !dates.Result.Any())
            {
                return(NoContent());
            }
            response.Result = AllocationsResponseMapper.MapDatesToDateListViewModel(dates.Result);
            return(Ok(response));
        }
        public async Task <IActionResult> GetStaticAllocationDetails([FromBody] DateViewModel request)
        {
            BaseResult <Allocations> response = new BaseResult <Allocations>();

            if (request == null)
            {
                response.IsError = true;
                response.Message = coreHelper.Constants.ErrorMessage.EmptyModel;
                return(BadRequest(response));
            }
            BaseResult <List <AllocationDetails> > allocationDetails = await iAllocations.GetStaticAllocaitonDetails(request);

            if (allocationDetails.Message != null && allocationDetails.IsError)
            {
                return(BadRequest(allocationDetails));
            }
            if (allocationDetails.IsError && allocationDetails.ExceptionMessage != null)
            {
                return(StatusCode(500, allocationDetails));
            }
            if (allocationDetails.Result == null || !allocationDetails.Result.Any())
            {
                return(NoContent());
            }
            response.Result = AllocationsResponseMapper.MapAllocationDetails(allocationDetails.Result);
            return(Ok(response));
        }