public AddEditProviderQAForStyleModel(ProviderQAStyle providerQAStyle)
     : this()
 {
     this.ProviderQAStyleId = providerQAStyle.ProviderQAStyleId;
     this.ProviderId        = providerQAStyle.ProviderId;
     this.Passed            = providerQAStyle.Passed ? "1" : "0";
     foreach (QAStyleFailureReason fr in providerQAStyle.QAStyleFailureReasons)
     {
         this.SelectedStyleFailureReasons.Add(fr.QAStyleFailureReasonId);
     }
 }
        public static ProviderQAStyle ToEntity(this AddEditProviderQAForStyleModel model, ProviderPortalEntities db)
        {
            Provider Provider = db.Providers.Find(model.ProviderId);

            ProviderQAStyle QA;

            if (model.ProviderQAStyleId.HasValue)
            {
                QA = db.ProviderQAStyles.Find(model.ProviderQAStyleId);
            }
            else
            {
                QA = new ProviderQAStyle
                {
                    ProviderId         = model.ProviderId,
                    CreatedByUserId    = Permission.GetCurrentUserId(),
                    CreatedDateTimeUtc = DateTime.UtcNow,
                    TextQAd            = Provider.MarketingInformation
                };
            }

            QA.Passed      = model.Passed == "1";
            QA.DetailsOfQA = model.DetailsOfQA;

            // Add the failure reasons
            foreach (Int32 frId in model.SelectedStyleFailureReasons)
            {
                QAStyleFailureReason fr = db.QAStyleFailureReasons.Find(frId);
                if (fr != null)
                {
                    QA.QAStyleFailureReasons.Add(fr);
                }
            }

            return(QA);
        }
 public ProviderQAForStyleJsonModel(ProviderQAStyle providerQAStyle)
     : this()
 {
     this.ProviderQAForComplianceId = providerQAStyle.ProviderQAStyleId;
     this.Passed = providerQAStyle.Passed;
 }