public ActionResult Index(int caseNr) { ServiceReference1.Service1Client client = new ServiceReference1.Service1Client(); var postList = new List <ServiceCasePostViewModel>(); ServiceCasePostViewModel serviceCasePost = new ServiceCasePostViewModel(); foreach (ServiceReference1.ServiceCasePost post in client.GetCase(caseNr).Posts) { serviceCasePost.CaseNr = caseNr; serviceCasePost.CaseMessage = post.Message; //serviceCasePost.CaseMessage = post.UserDisplayName; //serviceCasePost.CaseMessage = post.UserEmail; //serviceCasePost.CaseMessage = post.Private; postList.Add(serviceCasePost); } return(View(postList)); }
public ActionResult ShowServicCase(int caseNr) { ServiceReference1.Service1Client client = new ServiceReference1.Service1Client(); var posts = new List <ServiceCasePostViewModel>(); foreach (ServiceReference1.ServiceCasePost post in client.GetCase(caseNr).Posts) { ServiceCasePostViewModel serviceCasePost = new ServiceCasePostViewModel(); serviceCasePost.CaseMessage = post.Message; serviceCasePost.Name = post.Name; serviceCasePost.ContactEmail = post.ContactEmail; serviceCasePost.Private = post.Private; posts.Add(serviceCasePost); } var vm = new ServiceCaseViewModel(); vm.CaseNr = caseNr; vm.Posts = posts; return(View(vm)); }