Beispiel #1
0
        public async Task <IActionResult> CreateYeuCau(YeuCauDTO yeuCauDTO)
        {
            var yeuCau = yeuCauDTO.ToEntity();
            await _yeuCauService.CreateYeuCau(yeuCau);

            return(Ok(yeuCau));
        }
Beispiel #2
0
        public async Task <IActionResult> UpdateYeuCau(int id, [FromBody] YeuCauDTO yeuCauDTO)
        {
            var yeuCau = yeuCauDTO.ToEntity();
            await _yeuCauService.UpdateYeuCau(yeuCau);

            return(Ok(yeuCau));
        }
Beispiel #3
0
        public async Task <IActionResult> GetYeuCauById(int id)
        {
            var yeuCau = await _yeuCauService.GetYeuCauById(id);

            var result = YeuCauDTO.FromEntity(yeuCau);

            return(Ok(result));
        }
Beispiel #4
0
        public List <YeuCauDTO> SearchListYeuCau(string valueToSearch)
        {
            List <YeuCauDTO> List      = new List <YeuCauDTO>();
            string           query     = string.Format("SELECT * FROM dbo.YeuCau YCau WHERE CONCAT(YCau.MaYeuCau, YCau.TenYeuCau, YCau.NoiDungYeuCau, YCau.GhiChu) LIKE N'%" + valueToSearch + "%'");
            DataTable        dataTable = DataBaseConnection.Instance.ExecuteQuery(query);

            foreach (DataRow dataRow in dataTable.Rows)
            {
                YeuCauDTO yeuCau = new YeuCauDTO(dataRow);
                List.Add(yeuCau);
            }
            return(List);
        }
Beispiel #5
0
        public List <YeuCauDTO> GetListYeuCau()
        {
            List <YeuCauDTO> List      = new List <YeuCauDTO>();
            string           query     = "SELECT * FROM dbo.YeuCau";
            DataTable        dataTable = DataBaseConnection.Instance.ExecuteQuery(query);

            foreach (DataRow dataRow in dataTable.Rows)
            {
                YeuCauDTO yeuCau = new YeuCauDTO(dataRow);
                List.Add(yeuCau);
            }
            return(List);
        }