Exemplo n.º 1
0
        public ActionResult <List <ParcelAllocationDto> > GetAllocations([FromRoute] int parcelID)
        {
            var parcelDto = Parcel.GetByParcelID(_dbContext, parcelID);

            if (ThrowNotFound(parcelDto, "Parcel", parcelID, out var actionResult))
            {
                return(actionResult);
            }

            var parcelAllocationDtos = ParcelAllocation.ListByParcelID(_dbContext, parcelID);

            return(Ok(parcelAllocationDtos));
        }
Exemplo n.º 2
0
        public ActionResult <List <ParcelAllocationDto> > ListParcelsAllocationByAccountID([FromRoute] int accountID, [FromRoute] int year)
        {
            var parcelDtosEnumerable = Parcel.ListByAccountIDAndYear(_dbContext, accountID, year);

            if (parcelDtosEnumerable == null)
            {
                return(NotFound());
            }

            var parcelDtos           = parcelDtosEnumerable.ToList();
            var parcelIDs            = parcelDtos.Select(x => x.ParcelID).ToList();
            var parcelAllocationDtos = ParcelAllocation.ListByParcelID(_dbContext, parcelIDs);

            return(Ok(parcelAllocationDtos));
        }