コード例 #1
0
        public virtual async Task <ViewModelQueryResult <TViewModel> > PartiallyUpdate(TId id, JsonPatchDocument jsonPatchDocument)
        {
            var ofmQueryResult = await ApiModelRepository.Patch(id, jsonPatchDocument);

            var workoutViewModelQueryResult = new ViewModelQueryResult <TViewModel>();

            workoutViewModelQueryResult.HttpStatusCode = ofmQueryResult.HttpStatusCode;

            if ((int)ofmQueryResult.HttpStatusCode == 200)
            {
                workoutViewModelQueryResult.ViewModel =
                    Mapper.Map <TViewModel>(ofmQueryResult.OfmForGet);
            }
            else
            {
                workoutViewModelQueryResult.ErrorMessagesPresented = ofmQueryResult.ErrorMessagesPresented;
            }

            return(workoutViewModelQueryResult);
        }
コード例 #2
0
        public virtual async Task <ViewModelQueryResult <TViewModel> > GetById(TId id, TOfmResourceParameters resourceParameters)
        {
            var ofmQueryResult = await ApiModelRepository.GetSingle(id, resourceParameters);

            var workoutViewModelQueryResult = new ViewModelQueryResult <TViewModel>();

            workoutViewModelQueryResult.HttpStatusCode = ofmQueryResult.HttpStatusCode;

            if ((int)ofmQueryResult.HttpStatusCode == 200)
            {
                workoutViewModelQueryResult.ViewModel =
                    Mapper.Map <TViewModel>(ofmQueryResult.OfmForGet);
            }
            else
            {
                workoutViewModelQueryResult.ErrorMessagesPresented = ofmQueryResult.ErrorMessagesPresented;
            }

            return(workoutViewModelQueryResult);
        }
コード例 #3
0
        public virtual async Task <ViewModelQueryResult <TViewModel> > Delete(TId id)
        {
            var ofmQueryResult = await ApiModelRepository.Delete(id);

            var workoutViewModelQueryResult = new ViewModelQueryResult <TViewModel>();

            workoutViewModelQueryResult.HttpStatusCode = ofmQueryResult.HttpStatusCode;

            if ((int)ofmQueryResult.HttpStatusCode == 204)
            {
                workoutViewModelQueryResult.ViewModel =
                    Mapper.Map <TViewModel>(ofmQueryResult.OfmForGet);
            }
            else
            {
                workoutViewModelQueryResult.ErrorMessagesPresented = ofmQueryResult.ErrorMessagesPresented;
            }

            return(workoutViewModelQueryResult);
        }