Example #1
0
        /// <summary>
        /// Updates the referral Forwarded.
        /// </summary>
        /// <param name="referral">The referral.</param>
        /// <returns></returns>

        public Response <ReferralForwardedViewModel> UpdateReferralForwardedDetail(ReferralForwardedViewModel referral)
        {
            const string apiUrl   = baseRoute + "UpdateReferralForwardedDetail";
            var          response = communicationManager.Put <ReferralForwardedModel, Response <ReferralForwardedModel> >(referral.ToModel(), apiUrl);

            return(response.ToViewModel());
        }
        public void UpdateReferralForwardedDetail_Success()
        {
            // Arrange
            var referral = new ReferralForwardedViewModel
            {
                ReferralHeaderID    = 1,
                ReferralSentDate    = DateTime.UtcNow,
                SendingReferralToID = 5,
                OrganizationID      = 1,
                UserID        = 23,
                Comments      = "Comments Modified",
                ForceRollback = true
            };

            // Act
            var response = controller.UpdateReferralForwardedDetail(referral);

            // Assert
            Assert.IsTrue(response != null, "Response can't be null");
            Assert.IsTrue(response.ResultCode == 0, "Referral forwarded could not be updated.");
        }
        public void AddReferralForwardedDetail_Failed()
        {
            // Arrange
            var referral = new ReferralForwardedViewModel
            {
                ReferralHeaderID    = -1,
                ReferralSentDate    = DateTime.UtcNow,
                SendingReferralToID = 4,
                OrganizationID      = 1,
                UserID        = 23,
                Comments      = null,
                ForceRollback = true
            };

            // Act
            var response = controller.AddReferralForwardedDetail(referral);

            // Assert
            Assert.IsTrue(response != null, "Response can't be null");
            Assert.IsTrue(response.ResultCode != 0, "Invalid referral forwarded has been added.");
        }
Example #4
0
        /// <summary>
        /// To the model.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <returns></returns>
        public static ReferralForwardedModel ToModel(this ReferralForwardedViewModel model)
        {
            if (model == null)
            {
                return(null);
            }

            var entity = new ReferralForwardedModel
            {
                ReferralForwardedDetailID = model.ReferralForwardedDetailID,
                ReferralHeaderID          = model.ReferralHeaderID,
                SendingReferralToID       = model.SendingReferralToID,
                UserID           = model.UserID,
                ReferralSentDate = model.ReferralSentDate,
                Comments         = model.Comments,
                OrganizationID   = model.OrganizationID,
                ModifiedOn       = model.ModifiedOn
            };

            return(entity);
        }
Example #5
0
        /// <summary>
        /// To the view model.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        public static ReferralForwardedViewModel ToViewModel(this ReferralForwardedModel entity)
        {
            if (entity == null)
            {
                return(null);
            }

            var model = new ReferralForwardedViewModel
            {
                ReferralForwardedDetailID = entity.ReferralForwardedDetailID,
                ReferralHeaderID          = entity.ReferralHeaderID,
                SendingReferralToID       = entity.SendingReferralToID,
                UserID           = entity.UserID,
                ReferralSentDate = entity.ReferralSentDate,
                Comments         = entity.Comments,
                OrganizationID   = entity.OrganizationID,
                ModifiedOn       = entity.ModifiedOn
            };

            return(model);
        }
        public void UpdateReferralForwardedDetail_Failed()
        {
            // Arrange
            var referral = new ReferralForwardedViewModel
            {
                ReferralForwardedDetailID = -1,
                ReferralHeaderID          = -1,
                ReferralSentDate          = DateTime.UtcNow,
                SendingReferralToID       = 4,
                OrganizationID            = 1,
                UserID        = 23,
                Comments      = null,
                ForceRollback = true
            };

            // Act
            var response = controller.UpdateReferralForwardedDetail(referral);

            // Assert
            Assert.IsTrue(response != null, "Response can't be null");
            Assert.IsTrue(response.RowAffected == 0, "Updated referral forwarded with invalid data.");
        }
 public Response <ReferralForwardedViewModel> UpdateReferralForwardedDetail(ReferralForwardedViewModel referral)
 {
     return(referralForwardedRepository.UpdateReferralForwardedDetail(referral));
 }