Exemplo n.º 1
0
        /// <summary>
        /// Updates the assessment response.
        /// </summary>
        /// <param name="assessment">The assessment.</param>
        /// <returns></returns>
        public Response <AssessmentResponseViewModel> UpdateAssessmentResponse(AssessmentResponseViewModel assessment)
        {
            string apiUrl   = baseRoute + "updateAssessmentResponse";
            var    response = communicationManager.Put <AssessmentResponseModel, Response <AssessmentResponseModel> >(assessment.ToModel(), apiUrl);

            return(response.ToViewModel());
        }
Exemplo n.º 2
0
        /// <summary>
        /// Translate model to view model.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        public static AssessmentResponseViewModel ToViewModel(this AssessmentResponseModel entity)
        {
            if (entity == null)
            {
                return(null);
            }
            var model = new AssessmentResponseViewModel
            {
                AssessmentID = entity.AssessmentID,
                ContactID    = entity.ContactID,
                EnterDate    = entity.EnterDate,
                ResponseID   = entity.ResponseID,
                ModifiedOn   = entity.ModifiedOn
            };

            return(model);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Translate view model to model.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <returns></returns>
        public static AssessmentResponseModel ToModel(this AssessmentResponseViewModel model)
        {
            if (model == null)
            {
                return(null);
            }

            var entity = new AssessmentResponseModel
            {
                AssessmentID = model.AssessmentID,
                ContactID    = model.ContactID,
                EnterDate    = model.EnterDate,
                ResponseID   = model.ResponseID,
                ModifiedOn   = model.ModifiedOn
            };

            return(entity);
        }
        public void UpdateAssessmentResponse_Failed()
        {
            // Act
            var assessmentResponse = new AssessmentResponseViewModel
            {
                ResponseID    = -1,
                AssessmentID  = 0,
                ContactID     = 0,
                EnterDate     = DateTime.Now,
                ForceRollback = true
            };

            var response = controller.UpdateAssessmentResponse(assessmentResponse);

            // Assert
            Assert.IsTrue(response != null, "Response can't be null");
            Assert.IsTrue(response.ResultCode != 0, "Update assessment response expected to be failed.");
        }
        public void UpdateAssessmentResponse_Success()
        {
            // Act
            var assessmentResponse = new AssessmentResponseViewModel
            {
                ResponseID    = 1,
                AssessmentID  = 2,
                ContactID     = 2,
                EnterDate     = DateTime.Now,
                ForceRollback = true
            };

            var response = controller.UpdateAssessmentResponse(assessmentResponse);

            // Assert
            Assert.IsTrue(response != null, "Response can't be null");
            Assert.IsTrue(response.ResultCode == 0, "Assessment response could not updated.");
        }
Exemplo n.º 6
0
 public Response <AssessmentResponseViewModel> UpdateAssessmentResponse(AssessmentResponseViewModel assessmentResponse)
 {
     return(assessmentRepository.UpdateAssessmentResponse(assessmentResponse));
 }
Exemplo n.º 7
0
 public Response <AssessmentResponseViewModel> AddAssessmentResponse(AssessmentResponseViewModel assessmentResponse)
 {
     return(assessmentRepository.AddAssessmentResponse(assessmentResponse));
 }