コード例 #1
0
        public IEnumerable <Dosen> Get()
        {
            DosenRepo dosen     = new DosenRepo();
            var       listDosen = dosen.getAll();

            return(listDosen);
        }
コード例 #2
0
        public IActionResult Post([FromBody] Dosen value)
        {
            DosenRepo dosen = new DosenRepo();
            var       temp  = dosen.insert(value);

            return(Ok(temp));
        }
コード例 #3
0
        public IActionResult Put([FromBody] Dosen value)
        {
            DosenRepo dosen = new DosenRepo();

            if (dosen.update(value) == true)
            {
                return(Ok(value));
            }
            else
            {
                var response = new ContentResult()
                {
                    StatusCode = StatusCodes.Status404NotFound,
                };
                return(response);
            }
        }
コード例 #4
0
        public IActionResult Get(int id)
        {
            DosenRepo dosen = new DosenRepo();
            var       hasil = dosen.getById(id);

            if (hasil == null)
            {
                var response = new ContentResult()
                {
                    StatusCode = StatusCodes.Status204NoContent,
                };
                return(response);
            }
            else
            {
                return(Ok(hasil));
            }
        }
コード例 #5
0
        public IActionResult Get()
        {
            DosenRepo dosen     = new DosenRepo();
            var       listDosen = dosen.getAll();

            if (listDosen == null)
            {
                var response = new ContentResult()
                {
                    StatusCode = StatusCodes.Status204NoContent,
                };
                return(response);
            }
            else
            {
                return(Ok(listDosen));
            }
        }
コード例 #6
0
        public IActionResult Delete(int id)
        {
            DosenRepo dosen = new DosenRepo();
            Dosen     dos   = new Dosen();

            dos.Id = id;
            if (dosen.delete(dos) == true)
            {
                return(Ok(dos));
            }
            else
            {
                var response = new ContentResult()
                {
                    StatusCode = StatusCodes.Status404NotFound,
                };
                return(response);
            }
        }