public async Task <IActionResult> DeleteMyJob([FromQuery] int ma_kh, int ma_cv) { try { DanhSachMyJob myJob = new DanhSachMyJob(); myJob = await danhSachMyJobRepository.Get(w => w.ma_kh == ma_kh && w.ma_cong_viec == ma_cv); await danhSachMyJobRepository.Delete(myJob); return(Ok(new { code = 200, success = "Remove Job from My Job success" })); } catch (NullReferenceException e) { return(BadRequest(new { code = 400, error = "Delete my job fail : Error " + e.InnerException.Message })); } }
public async Task <IActionResult> AddMyJob([FromBody] CreateMyJobCommand command) { try { DanhSachMyJob myJob = new DanhSachMyJob(); myJob.ma_kh = command.ma_kh; myJob.ma_cong_viec = command.ma_cong_viec; await danhSachMyJobRepository.Create(myJob); return(Ok(new { code = 200, success = "Add My Job is success" })); } catch (Exception e) { return(BadRequest(new { code = 400, error = "Fail: error" + e.InnerException.Message })); } }