Exemple #1
0
        public TestDTO GetAndWriteParcelDetailsById(TestViewModel testViewModel)
        {
            // this is where ViewModel validation is being arranged normally

            try
            {
                var parcel = _parcelService.GetById(testViewModel.ParcelId);

                var result = new TestDTO
                {
                    Status         = TestStatus.Success,
                    SenderName     = parcel.SenderData.FirstName,
                    ReceiverName   = parcel.ReceiverData.FirstName,
                    StoragePointId = (int)parcel.StorePlaceId
                };

                return(result);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);

                var result = new TestDTO
                {
                    Status = TestStatus.Failure
                };

                return(result);
            }
        }
Exemple #2
0
        public ParcelStatus GetParcelStatusById(int id)
        {
            ParcelStatus status = ParcelStatus.Unknown;

            try
            {
                Parcel postedParcel = _parcelService.GetById(id);
                status = postedParcel.ParcelStatus;
            }
            catch (ParcelNotFoundInDatabaseException e)
            {
                Console.WriteLine(e.Message);
            }

            return(status);
        }