private CommentViewModel Map(CreditComment creditComment)
        {
            var viewModel = new CommentViewModel
            {
                Id              = creditComment.CreditCommentId,
                Comment         = creditComment.Comment,
                CommentDate     = creditComment.CommentDate,
                CreditProcessId = creditComment.CreditProcessId,
                IsNew           = false,
            };

            return(viewModel);
        }
Exemple #2
0
        private static CreditComment Map(CommentViewModel viewModel)
        {
            var creditComment = new CreditComment
            {
                CreditCommentId         = viewModel.Id,
                CreditProcessId         = viewModel.CreditProcessId,
                creditProcessXCompanyId = viewModel.CreditProcessXCompanyId,
                Comment     = viewModel.Comment,
                CommentDate = viewModel.CommentDate,
            };

            return(creditComment);
        }
        public void UpdateCreditProcessFlowComment(CreditComment creditProcessFlowComment)
        {
            var entry = _databaseModel.Entry(creditProcessFlowComment);

            if (entry.State == EntityState.Detached)
            {
                var set            = _databaseModel.Set <CreditProcessXCompany>();
                var attachedEntity = set.Find(creditProcessFlowComment.CreditCommentId);  // You need to have access to key

                if (attachedEntity != null)
                {
                    var attachedEntry = _databaseModel.Entry(attachedEntity);
                    attachedEntry.CurrentValues.SetValues(creditProcessFlowComment);
                }
                else
                {
                    entry.State = EntityState.Modified; // This should attach entity
                }
            }

            _databaseModel.SaveChanges();
        }
Exemple #4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="creditComment"></param>
 private void UpdateCreditProcessFlowComment(CreditComment creditComment)
 {
     _creditProcessesRepository.UpdateCreditProcessFlowComment(creditComment);
 }
Exemple #5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="creditComment"></param>
 private void AddCreditProcessFlowComment(CreditComment creditComment)
 {
     _creditProcessesRepository.AddCreditProcessFlowComment(creditComment);
 }
        public void AddCreditProcessFlowComment(CreditComment creditProcessFlowComment)
        {
            _databaseModel.CreditComments.Add(creditProcessFlowComment);

            _databaseModel.SaveChanges();
        }