public Response <PresentIllnessViewModel> UpdateHPI(PresentIllnessViewModel hpi)
        {
            string apiUrl = BaseRoute + "UpdateHPI";

            var response = _communicationManager.Put <PresentIllnessModel, Response <PresentIllnessModel> >(hpi.ToModel(), apiUrl);

            return(response.ToModel());
        }
Beispiel #2
0
        public static PresentIllnessModel ToModel(this PresentIllnessViewModel entity)
        {
            if (entity == null)
            {
                return(null);
            }

            var model = new PresentIllnessModel
            {
                EncounterID = entity.EncounterID,
                ContactID   = entity.ContactID,
                HPIID       = entity.HPIID,
                TakenBy     = entity.TakenBy,
                TakenTime   = entity.TakenTime,
                ModifiedOn  = entity.ModifiedOn
            };

            return(model);
        }
Beispiel #3
0
        public void AddHPI_Failure()
        {
            // Act
            var srModel = new PresentIllnessViewModel
            {
                HPIID         = 0,
                ContactID     = -1,
                EncounterID   = null,
                TakenBy       = 1,
                TakenTime     = DateTime.Now,
                ForceRollback = true
            };

            var response = controller.AddHPI(srModel);

            // Assert
            Assert.IsNotNull(response, "Response can not be null");
            Assert.IsTrue(response.ID <= 0, "Present  Illness created for invalid data.");
        }
Beispiel #4
0
        public void UpdateHPI_Failure()
        {
            // Act
            var srModel = new PresentIllnessViewModel
            {
                HPIID         = -1,
                ContactID     = -1,
                EncounterID   = null,
                TakenBy       = 1,
                TakenTime     = DateTime.MinValue,
                ForceRollback = true
            };

            var response = controller.UpdateHPI(srModel);

            // Assert
            Assert.IsNotNull(response, "Response can not be null");
            Assert.IsTrue(response.RowAffected == 0, "Present Illness updated for invalid data.");
        }
Beispiel #5
0
        public void UpdateHPI_Success()
        {
            // Act
            var srModel = new PresentIllnessViewModel
            {
                HPIID         = 1,
                ContactID     = 1,
                EncounterID   = null,
                TakenBy       = 1,
                TakenTime     = DateTime.Now,
                ForceRollback = true
            };

            var response = controller.UpdateHPI(srModel);

            // Assert
            Assert.IsNotNull(response, "Response can not be null");
            Assert.IsTrue(response.RowAffected > 0, "Present  Illness could not be updated.");
        }
Beispiel #6
0
 public Response <PresentIllnessViewModel> UpdateHPI(PresentIllnessViewModel HPI)
 {
     HPI.TakenTime = HPI.TakenTime.ToUniversalTime();
     return(_PresentIllnessRepository.UpdateHPI(HPI));
 }