Beispiel #1
0
        public ActionResult UpdateReviewPanel(PanelFormData panelFormData)
        {
            repo.UpdateReviewPanel(panelFormData);
            var redirectUrl = new UrlHelper(Request.RequestContext).Action("Index", "ReviewPanel");

            return(Json(new { Url = redirectUrl }));
        }
        public void UpdateReviewPanel(PanelFormData panelData)
        {
            ReviewPanel reviewPanel = dbContext.ReviewPanels.SingleOrDefault(r => r.ReviewID == panelData.ReviewID);

            if (reviewPanel != null)
            {
                CaseMember    member       = panelData.Reviews[0];
                List <Member> panelMembers = dbContext.Members.Where(m => member.Members.Contains(m.MemberID)).ToList();
                reviewPanel.Members.Clear();
                dbContext.SaveChanges();
                reviewPanel.ReviewDetails = panelData.ReviewDetails;
                reviewPanel.CreatedBy     = panelData.CreatedBy;
                reviewPanel.CreatedOn     = panelData.CreatedOn;
                reviewPanel.Members       = panelMembers;

                dbContext.SaveChanges();
            }
        }
        public void InsertReviewPanel(PanelFormData panelFormData)
        {
            CaseMember[] caseMembers = panelFormData.Reviews;
            if (caseMembers.Length > 0)
            {
                foreach (CaseMember caseMember in caseMembers)
                {
                    ReviewPanel reviewPanel = new ReviewPanel();
                    reviewPanel.CaseID        = caseMember.CaseID;
                    reviewPanel.ReviewDetails = panelFormData.ReviewDetails;
                    reviewPanel.CreatedBy     = panelFormData.CreatedBy;
                    reviewPanel.CreatedOn     = panelFormData.CreatedOn;
                    List <Member> panelMembers = dbContext.Members.Where(m => caseMember.Members.Contains(m.MemberID)).ToList();
                    reviewPanel.Members = panelMembers;
                    reviewPanel.Case    = dbContext.Cases.SingleOrDefault(c => c.CaseID == caseMember.CaseID);

                    dbContext.ReviewPanels.Add(reviewPanel);
                }
                dbContext.SaveChanges();
            }
        }