Esempio n. 1
0
        public IActionResult Post([FromBody] Mhs value)
        {
            MhsRepo mhs      = new MhsRepo();
            var     feedback = mhs.insert(value);

            return(Ok(feedback));
        }
Esempio n. 2
0
        public IActionResult Put([FromBody] Mhs value)
        {
            MhsRepo mhs = new MhsRepo();

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

            if (hasil == null)
            {
                var response = new ContentResult()
                {
                    StatusCode = StatusCodes.Status204NoContent,
                };
                return(response);
            }
            else
            {
                return(Ok(hasil));
            }
        }
Esempio n. 4
0
        public IActionResult Get()
        {
            MhsRepo mhs     = new MhsRepo();
            var     listMhs = mhs.getAll();

            if (listMhs == null)
            {
                var response = new ContentResult()
                {
                    StatusCode = StatusCodes.Status204NoContent,
                };
                return(response);
            }
            else
            {
                return(Ok(listMhs));
            }
        }
Esempio n. 5
0
        public IActionResult Delete(int id)
        {
            MhsRepo mhs = new MhsRepo();
            Mhs     mh  = new Mhs();

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