Ejemplo n.º 1
0
        public async Task <IActionResult> Get()
        {
            var username = User.Identity.Name;

            if (!await _usr.CheckUserInRole(username, "admin"))
            {
                return(Unauthorized());
            }

            var models = await _barang.GetAll();

            return(Ok(models));
        }
        public async Task <IActionResult> Get()
        {
            var cek = await _user.CekApiAuth(User.Identity.Name,
                                             ControllerContext.ActionDescriptor.ControllerName,
                                             ControllerContext.ActionDescriptor.ActionName);

            if (cek)
            {
                return(Ok(await _barang.GetAll()));
            }
            else
            {
                return(Unauthorized());
            }
        }
Ejemplo n.º 3
0
        public IActionResult Index()
        {
            var models = _barang.GetAll();

            return(View(models));
        }
        public async Task <IEnumerable <Barang> > GetAll()
        {
            var models = await _barang.GetAll();

            return(models);
        }
Ejemplo n.º 5
0
 public async Task <BarangResponse> GetAll(string search, string order, string orderDir, int startRec, int pageSize, int draw)
 {
     return(await dep.GetAll(search, order, orderDir, startRec, pageSize, draw));
 }