public IHttpActionResult PostGrade([FromBody] Grade g, [FromUri] int id, [FromUri] int id2)
        {
            g.sectionid = id;
            g.subjectid = id2;
            graderepo.Insert(g);

            /*string url = Url.Link("GetGradeById", new { id = g.sectionid, id2 = g.subjectid, id3 = g.gradeid });
             * return Created(url, g);*/

            g.HyperLinks.Add(new HyperLink()
            {
                HRef = "http://localhost:44347/api/teachers/sections/" + g.sectionid + "/subjects/" + g.subjectid + "/grades/" + g.gradeid, HttpMethod = "GET", Relation = "Get Grade"
            });
            g.HyperLinks.Add(new HyperLink()
            {
                HRef = "http://localhost:44347/api/teachers/sections/" + g.sectionid + "/subjects/" + g.subjectid + "/grades/", HttpMethod = "POST", Relation = "Self"
            });
            g.HyperLinks.Add(new HyperLink()
            {
                HRef = "http://localhost:44347/api/teachers/sections/" + g.sectionid + "/subjects/" + g.subjectid + "/grades/" + g.gradeid, HttpMethod = "PUT", Relation = "Edit Grade"
            });
            g.HyperLinks.Add(new HyperLink()
            {
                HRef = "http://localhost:44347/api/teachers/sections/" + g.sectionid + "/subjects/" + g.subjectid + "/grades/" + g.gradeid, HttpMethod = "DELETE", Relation = "Delete Grade"
            });


            return(Ok());
        }
Example #2
0
        //[TeacherAuthorization]
        public IHttpActionResult PostGrade([FromBody] Grade g, [FromUri] int id, [FromUri] int id2)
        {
            g.sectionid = id;
            g.subjectid = id2;
            graderepo.Insert(g);
            string url = Url.Link("GetGradeById", new { id = g.sectionid, id2 = g.subjectid, id3 = g.gradeid });

            return(Created(url, g));
        }
Example #3
0
        public string AddGrade([FromBody] dynamic Json)
        {
            GradeModel gradeModel = new GradeModel();

            gradeModel.userno  = HttpContext.Session.GetString("user");
            gradeModel.paperid = Json.papers;
            gradeModel.grade   = Json.grade;
            Debug.WriteLine(gradeModel.grade + "!!!!!!!!!!!!");

            gradeRepository.Insert(gradeModel);

            return(null);
        }