Example #1
0
        public IActionResult PutBarang(String id, [FromBody] Barang value)
        {
            RepositoryBarang RP = new RepositoryBarang();

            try
            {
                RP.updateData(id, value);
                return(Ok());
            }
            catch (Exception e)
            {
                return(BadRequest(e));
            }
        }
Example #2
0
        public IActionResult DeleteBarang(String id)
        {
            RepositoryBarang RP = new RepositoryBarang();

            try
            {
                RP.deleteData(id);
                return(Ok());
            }
            catch (Exception)
            {
                return(BadRequest());
            }
        }
Example #3
0
        public IActionResult PostBarang([FromBody] Barang value)
        {
            RepositoryBarang RP = new RepositoryBarang();

            try
            {
                RP.insertData(value);
                return(Created("", value));
            }
            catch (Exception)
            {
                return(BadRequest());
            }
        }
Example #4
0
        public IActionResult GetBarangByMerk(String merk)
        {
            RepositoryBarang RP = new RepositoryBarang();

            try
            {
                var hasil = RP.getBarangByMerk(merk);
                return(Ok(hasil));
            }
            catch (Exception)
            {
                return(NotFound());
            }
        }
Example #5
0
        public IActionResult GetBarangByKategori(String idKategori)
        {
            RepositoryBarang RP = new RepositoryBarang();

            try
            {
                var hasil = RP.getBarangByKategori(idKategori);
                return(Ok(hasil));
            }
            catch (Exception)
            {
                return(NotFound());
            }
        }
Example #6
0
        public IActionResult GetBarang()
        {
            RepositoryBarang RP = new RepositoryBarang();

            try
            {
                List <Barang> List = RP.getAll();
                return(Ok(List));
            }
            catch (Exception)
            {
                return(NotFound());
            }
        }
Example #7
0
        public IActionResult SearchBarang(String search)
        {
            RepositoryBarang RP = new RepositoryBarang();

            try
            {
                var hasil = RP.search(search);
                return(Ok(hasil));
            }
            catch (Exception)
            {
                return(NotFound());
            }
        }