Beispiel #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());
            }
        }
        public IActionResult Index()
        {
            var models = _barang.GetAll();

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

            return(models);
        }
Beispiel #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));
 }