Exemplo n.º 1
0
        public IActionResult Post([FromBody] Matkul value)
        {
            MatkulRepo matkul   = new MatkulRepo();
            var        feedback = matkul.insert(value);

            return(Ok(feedback));
        }
Exemplo n.º 2
0
        public IActionResult Put([FromBody] Matkul value)
        {
            MatkulRepo matkul = new MatkulRepo();

            if (matkul.update(value) == true)
            {
                return(Ok(value));
            }
            else
            {
                var response = new ContentResult()
                {
                    StatusCode = StatusCodes.Status404NotFound,
                };
                return(response);
            }
        }
Exemplo n.º 3
0
        public IActionResult Get(int id)
        {
            MatkulRepo matkul = new MatkulRepo();
            var        hasil  = matkul.getById(id);

            if (hasil == null)
            {
                var response = new ContentResult()
                {
                    StatusCode = StatusCodes.Status204NoContent,
                };
                return(response);
            }
            else
            {
                return(Ok(hasil));
            }
        }
Exemplo n.º 4
0
        public IActionResult Get()
        {
            MatkulRepo matkul     = new MatkulRepo();
            var        listMatkul = matkul.getAll();

            if (listMatkul == null)
            {
                var response = new ContentResult()
                {
                    StatusCode = StatusCodes.Status204NoContent,
                };
                return(response);
            }
            else
            {
                return(Ok(listMatkul));
            }
        }
Exemplo n.º 5
0
        public IActionResult Delete(int id)
        {
            MatkulRepo matkul = new MatkulRepo();
            Matkul     mat    = new Matkul();

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