public AllCommentVm GetAllComents(int Id) { DeskComputers deskComputer = Context.Items.OfType <DeskComputers>().FirstOrDefault(desk => desk.Id == Id); IEnumerable <Comment> comments = deskComputer.Comments; IEnumerable <CommentVm> allCommentsVM = Mapper.Map <IEnumerable <Comment>, IEnumerable <CommentVm> >(comments); AllCommentVm vm = new AllCommentVm() { AllComments = allCommentsVM }; return(vm); }
public AllCommentVm GetAllComents(int Id) { Notebooks notebooks = Context.Items.OfType <Notebooks>().FirstOrDefault(desk => desk.Id == Id); IEnumerable <Comment> comments = notebooks.Comments; IEnumerable <CommentVm> allCommentsVM = Mapper.Map <IEnumerable <Comment>, IEnumerable <CommentVm> >(comments); AllCommentVm vm = new AllCommentVm() { AllComments = allCommentsVM }; return(vm); }
public ActionResult AllComments(int Id) { AllCommentVm vm = service.GetAllComents(Id); return(this.PartialView("_AllCommentsPartial", vm)); }