public IHttpActionResult PutCourseNotice([FromBody] CourseNotice c, [FromUri] int id, [FromUri] int id1, [FromUri] int id2, [FromUri] int id3)
        {
            c.classid   = id;
            c.sectionid = id1;
            c.subjectid = id2;
            c.noticeid  = id3;
            courrepo.Edit(c);

            c.HyperLinks.Add(new HyperLink()
            {
                HRef = "http://localhost:44347/api/teachers/classes/" + c.classid + "/sections/" + c.sectionid + "/subjects/" + c.subjectid + "/cnotices/" + c.noticeid, HttpMethod = "GET", Relation = "Get Notice"
            });
            c.HyperLinks.Add(new HyperLink()
            {
                HRef = "http://localhost:44347/api/teachers/classes/" + c.classid + "/sections/" + c.sectionid + "/subjects/" + c.subjectid + "/cnotices/", HttpMethod = "POST", Relation = "Create Notice"
            });
            c.HyperLinks.Add(new HyperLink()
            {
                HRef = "http://localhost:44347/api/teachers/classes/" + c.classid + "/sections/" + c.sectionid + "/subjects/" + c.subjectid + "/cnotices/" + c.noticeid, HttpMethod = "PUT", Relation = "Self"
            });
            c.HyperLinks.Add(new HyperLink()
            {
                HRef = "http://localhost:44347/api/teachers/classes/" + c.classid + "/sections/" + c.sectionid + "/subjects/" + c.subjectid + "/cnotices/" + c.noticeid, HttpMethod = "DELETE", Relation = "Delete Notice"
            });


            return(Ok(c));
        }
        public IHttpActionResult PostCourseNotice([FromBody] CourseNotice c, [FromUri] int id, [FromUri] int id1, [FromUri] int id2)
        {
            c.classid   = id;
            c.sectionid = id1;
            c.subjectid = id2;
            courrepo.Insert(c);
            string url = Url.Link("GetCourseNoticeById", new { id = c.classid, id1 = c.sectionid, id2 = c.subjectid, id3 = c.noticeid });

            c.HyperLinks.Add(new HyperLink()
            {
                HRef = "http://localhost:44347/api/teachers/classes/" + c.classid + "/sections/" + c.sectionid + "/subjects/" + c.subjectid + "/cnotices/" + c.noticeid, HttpMethod = "GET", Relation = "Get Notice"
            });
            c.HyperLinks.Add(new HyperLink()
            {
                HRef = "http://localhost:44347/api/teachers/classes/" + c.classid + "/sections/" + c.sectionid + "/subjects/" + c.subjectid + "/cnotices/", HttpMethod = "POST", Relation = "Self"
            });
            c.HyperLinks.Add(new HyperLink()
            {
                HRef = "http://localhost:44347/api/teachers/classes/" + c.classid + "/sections/" + c.sectionid + "/subjects/" + c.subjectid + "/cnotices/" + c.noticeid, HttpMethod = "PUT", Relation = "Edit Notice"
            });
            c.HyperLinks.Add(new HyperLink()
            {
                HRef = "http://localhost:44347/api/teachers/classes/" + c.classid + "/sections/" + c.sectionid + "/subjects/" + c.subjectid + "/cnotices/" + c.noticeid, HttpMethod = "DELETE", Relation = "Delete Notice"
            });


            return(Created(url, c));
        }
        public IHttpActionResult GetCourseNotice([FromUri] int id, [FromUri] int id1, [FromUri] int id2, [FromUri] int id3)
        {
            CourseNotice c = courrepo.GetNoticeByClassSectionSubject(id, id1, id2, id3);
            {
                if (c == null)
                {
                    return(StatusCode(HttpStatusCode.NoContent));
                }

                c.HyperLinks.Add(new HyperLink()
                {
                    HRef = "http://localhost:44347/api/teachers/classes/" + c.classid + "/sections/" + c.sectionid + "/subjects/" + c.subjectid + "/cnotices/" + c.noticeid, HttpMethod = "GET", Relation = "Self"
                });
                c.HyperLinks.Add(new HyperLink()
                {
                    HRef = "http://localhost:44347/api/teachers/classes/" + c.classid + "/sections/" + c.sectionid + "/subjects/" + c.subjectid + "/cnotices/", HttpMethod = "POST", Relation = "Create Notice"
                });
                c.HyperLinks.Add(new HyperLink()
                {
                    HRef = "http://localhost:44347/api/teachers/classes/" + c.classid + "/sections/" + c.sectionid + "/subjects/" + c.subjectid + "/cnotices/" + c.noticeid, HttpMethod = "PUT", Relation = "Edit Notice"
                });
                c.HyperLinks.Add(new HyperLink()
                {
                    HRef = "http://localhost:44347/api/teachers/classes/" + c.classid + "/sections/" + c.sectionid + "/subjects/" + c.subjectid + "/cnotices/" + c.noticeid, HttpMethod = "DELETE", Relation = "Delete Notice"
                });


                return(Ok(c));
            }
        }
Example #4
0
 //[TeacherAuthorization]
 public IHttpActionResult PutCourseNotice([FromBody] CourseNotice c, [FromUri] int id, [FromUri] int id1, [FromUri] int id2, [FromUri] int id3)
 {
     c.classid   = id;
     c.sectionid = id1;
     c.subjectid = id2;
     c.noticeid  = id3;
     courrepo.Edit(c);
     return(Ok(c));
 }
Example #5
0
        //[TeacherAuthorization]
        public IHttpActionResult PostCourseNotice([FromBody] CourseNotice c, [FromUri] int id, [FromUri] int id1, [FromUri] int id2)
        {
            c.classid   = id;
            c.sectionid = id1;
            c.subjectid = id2;
            courrepo.Insert(c);
            string url = Url.Link("GetCourseNoticeById", new { id = c.classid, id1 = c.sectionid, id2 = c.subjectid, id3 = c.noticeid });

            return(Created(url, c));
        }
Example #6
0
 //[TeacherAuthorization]
 public IHttpActionResult GetCourseNotice([FromUri] int id, [FromUri] int id1, [FromUri] int id2, [FromUri] int id3)
 {
     CourseNotice c = courrepo.GetNoticeByClassSectionSubject(id, id1, id2, id3);
     {
         if (c == null)
         {
             return(StatusCode(HttpStatusCode.NoContent));
         }
         return(Ok(c));
     }
 }
Example #7
0
        public ResultEntity addCourseNotice(int?courseID, String courseNotice)
        {
            CourseNotice couNotice = courseService.getNoticeByCouID(courseID);

            if (couNotice == null)//未曾有过课程介绍
            {
                couNotice          = new CourseNotice();
                couNotice.courseID = (courseID);
            }
            couNotice.courseNotice = (courseNotice);

            ResultEntity resultEntity = new ResultEntity();

            resultEntity.setState(courseService.addCourseNotice(couNotice));
            resultEntity.setMessage(resultEntity.getState() == 1 ? "公告发布成功!" : "公告发布失败!");
            return(resultEntity);
        }
 public static int?update(CourseNotice courseNotice)
 {
     return(Global.db.Updateable(courseNotice).ExecuteCommand());
 }
 public static int?insert(CourseNotice courseNotice)
 {
     return(courseNotice.id != null?Global.db.Saveable <CourseNotice>(courseNotice).ExecuteCommand() : Global.db.Insertable(courseNotice).ExecuteCommand());
 }