public bool Update(TheoDoiThongTinDTO thongtinDto) { try { var thongtin = _thongtinRepository.GetById(thongtinDto.MaThongTin); // check nhan vien exist if (thongtin == null) { return(false); } //Update nhan vien detail thongtin.MaThongTin = thongtinDto.MaThongTin; thongtin.MaKhachHang = thongtinDto.MaKhachHang; thongtin.TenThongTin = thongtinDto.TenThongTin; thongtin.TenBenh = thongtinDto.TenBenh; thongtin.TenThuoc = thongtinDto.TenThuoc; thongtin.ThoiGianDanhThuoc = thongtinDto.ThoiGianDanhThuoc; thongtin.TrieuChung = thongtinDto.TrieuChung; thongtin.KetQua = thongtinDto.KetQua; thongtin.GhiChu = thongtinDto.GhiChu; _thongtinRepository.Update(thongtin); _unitOfWork.Commit(); return(true); } catch (Exception ex) { return(false); } }
public bool Create(TheoDoiThongTinDTO thongtinDto) { try { var thongtin = new TheoDoiThongTin { MaThongTin = Guid.NewGuid(), MaKhachHang = thongtinDto.MaKhachHang, TenThongTin = thongtinDto.TenThongTin, TenBenh = thongtinDto.TenBenh, TenThuoc = thongtinDto.TenThuoc, ThoiGianDanhThuoc = thongtinDto.ThoiGianDanhThuoc, TrieuChung = thongtinDto.TrieuChung, KetQua = thongtinDto.KetQua, GhiChu = thongtinDto.GhiChu }; _thongtinRepository.Insert(thongtin); _unitOfWork.Commit(); return(true); } catch (Exception e) { return(false); } }
public async Task <BaseResponse> Update(TheoDoiThongTinDTO thongtinDto) { try { var result = _thongtinService.Update(thongtinDto); if (result) { return(await Task.FromResult(new BaseResponse(result))); } return(await Task.FromResult(new BaseResponse(Message.UpdateNotSuccess))); } catch (Exception e) { return(await Task.FromResult(new BaseResponse(Message.UpdateNotSuccess))); } }