Example #1
0
        public IActionResult FindTranByUsername([FromBody] string username)
        {
            TransactionDAO dao = new TransactionDAO(_context);
            List <AccessoryTransaction> list = dao.FindByUsername(username);

            return(new JsonResult(list));
        }
Example #2
0
        public IActionResult FindAll([FromBody] DTO.TranSearchObj dto)
        {
            TransactionDAO dao = new TransactionDAO(_context);
            List <AccessoryTransaction> list;

            if (dto.UsernameSearch.Equals(""))
            {
                if (dto.StatusSearch.Equals("All"))
                {
                    list = dao.FindAll();
                }
                else
                {
                    list = dao.FindAllByStatus(dto.StatusSearch);
                }
            }
            else
            {
                if (dto.StatusSearch.Equals("All"))
                {
                    list = dao.FindByUsername(dto.UsernameSearch);
                }
                else
                {
                    list = dao.FindByStatusAndUsername(dto.StatusSearch, dto.UsernameSearch);
                }
            }
            return(new JsonResult(list));
        }