Exemple #1
0
        public ActionResult ViewReport(int?classid, int id = 0)
        {
            ViewClass       @class = null;
            ViewClassReport report = null;

            if (classid > 0)
            {
                @class = client.Get((int)classid);
                report = @class.Reports[0];
            }
            else if (id > 0)
            {
                ClassReportServiceClient rc = new ClassReportServiceClient();
                report = rc.Get(id);
                @class = client.Get(report.ClassId);
            }
            int nowIndex = 0;

            for (int i = 0; i < @class.Reports.Count; i++)
            {
                if (@class.Reports[i].Id == report.Id)
                {
                    nowIndex = i;
                    break;
                }
            }
            //更多中移除当前活动
            @class.Reports.RemoveAt(nowIndex);
            ViewBag.Class = @class;
            return(View(report));
        }
        // 添加活动报道
        public ActionResult AddReport(int classId, int?id)
        {
            ViewClassReport report = new ViewClassReport();

            if (id != null)
            {
                ClassReportServiceClient client = new ClassReportServiceClient();
                report = client.Get((int)id);
            }
            else
            {
                report.Id      = 0;
                report.ClassId = 0;
            }
            return(View(report));
        }