public async Task <IActionResult> CreateYeuCau(YeuCauDTO yeuCauDTO) { var yeuCau = yeuCauDTO.ToEntity(); await _yeuCauService.CreateYeuCau(yeuCau); return(Ok(yeuCau)); }
public async Task <IActionResult> UpdateYeuCau(int id, [FromBody] YeuCauDTO yeuCauDTO) { var yeuCau = yeuCauDTO.ToEntity(); await _yeuCauService.UpdateYeuCau(yeuCau); return(Ok(yeuCau)); }
public async Task <IActionResult> GetYeuCauById(int id) { var yeuCau = await _yeuCauService.GetYeuCauById(id); var result = YeuCauDTO.FromEntity(yeuCau); return(Ok(result)); }
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); }
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); }