예제 #1
0
        public Exam Post([FromBody] Exam model)
        {
            // POST: api/User
            // this post method insert the new row or update the current row if there is a record with same ID
            ExamDE de    = new ExamDE();
            Exam   sonuc = de.AddExam(model);

            return(sonuc);
        }
예제 #2
0
        public IEnumerable <Exam> Get(int id)
        {
            // GET: api/Exam
            //HttpContext.RiseError(new InvalidOperationException("Test"));
            Exam   model = new Exam();
            ExamDE de    = new ExamDE();

            return(de.GetExam(id));
        }
예제 #3
0
        public IActionResult Delete(int id)
        {
            // DELETE: api/ApiWithActions/5
            ExamDE de    = new ExamDE();
            bool   sonuc = de.DeleteExam(id);

            if (sonuc)
            {
                return(Ok());
            }
            else
            {
                return(NotFound());
            }
        }
예제 #4
0
        public IActionResult Put([FromBody] Exam model)
        {
            // POST: api/Exam
            // this post method insert the new row or update the current row if there is a record with same ID
            ExamDE de    = new ExamDE();
            bool   sonuc = de.UpdateExam(model);

            if (sonuc)
            {
                return(Ok());
            }
            else
            {
                return(NotFound());
            }
        }