public async Task <IHttpActionResult> deleteVaiTro(int Id) { VaiTroRepository repo = new VaiTroRepository(_connectionString); var result = await repo.Delete(Id); return(Content(HttpStatusCode.OK, result)); }
public async Task <IHttpActionResult> GetListVaiTroByProjection() { VaiTroRepository repo = new VaiTroRepository(_connectionString); IEnumerable <dynamic> listVaiTro = await repo.SelectAllByCriteriaProjection("VaiTroId,HoTen", "", "", 1, 2); return(Ok(listVaiTro)); }
public async Task <IHttpActionResult> GetListVaiTroByCriteriaCount() { VaiTroRepository repo = new VaiTroRepository(_connectionString); int listVaiTro = await repo.SelectAllByCriteriaCount(""); return(Ok(listVaiTro)); }
public async Task <IHttpActionResult> GetListVaiTroByCriteria() { VaiTroRepository repo = new VaiTroRepository(_connectionString); IEnumerable <VaiTro> listVaiTro = await repo.SelectAllByCriteria("", ""); return(Content(HttpStatusCode.OK, listVaiTro)); }
public async Task <IEnumerable <SongAn.QLDN.Entity.MSSQL_QLDN_MAIN.Entity.VaiTro> > Execute(string connectionString) { var repo = new VaiTroRepository(connectionString); var listVaiTro = await repo.SelectAll(); return(listVaiTro); }
public async Task <IHttpActionResult> InsertVaiTro([FromBody] VaiTro vaitro) { VaiTroRepository repo = new VaiTroRepository(_connectionString); vaitro.NgayTaoDT = DateTime.Now; vaitro.NgaySuaDT = DateTime.Now; var result = await repo.Insert(vaitro); return(Content(HttpStatusCode.OK, result)); }
public async Task <IHttpActionResult> GetListVaiTroBySearchString(string search) { VaiTroRepository repo = new VaiTroRepository(_connectionString); var _whereClause = ""; _whereClause += string.Format("MaVaiTro LIKE '%{0}%' OR ", search); _whereClause += string.Format("TenVaiTro LIKE '%{0}%' ", search); IEnumerable <VaiTro> listVaiTro = await repo.SelectAllByCriteria(_whereClause, ""); return(Content(HttpStatusCode.OK, listVaiTro)); }
public async Task <IHttpActionResult> GetVaiTroById(int id) { var repo = new VaiTroRepository(_connectionString); var objResult = await repo.SelectOne(id); if (objResult == null) { //422 return(Content(HttpStatusCode.NoContent, new { Message = "Khong tim thay nguoi dung" })); } return(Content(HttpStatusCode.OK, objResult)); }
public UnitOfWork(QuanLyPhongMachEntities context) { this.context = context; Nhanviens = new NhanVienRepository(context); Thuocs = new ThuocRepository(context); VaiTroes = new VaiTroRepository(context); PhieuKhams = new PhieuKhamRepository(context); BenhNhans = new BenhNhanRepository(context); Benhs = new BenhRepository(context); ChiTietBenhs = new ChiTietBenhRepository(context); ChiTietDonThuocs = new ChiTietDonThuocRepository(context); DonThuocs = new DonThuocRepository(context); BaoCaos = new BaoCaoRepository(context); }
public async Task <IHttpActionResult> InsertVaiTroTest() { VaiTroRepository repo = new VaiTroRepository(_connectionString); VaiTro vaitro = new VaiTro(); vaitro.MaVaiTro = Guid.NewGuid().ToString(); vaitro.TenVaiTro = Guid.NewGuid().ToString(); vaitro.KhoaYN = false; vaitro.CtrVersion = 1; VaiTro objResult = await repo.Insert(vaitro); return(Ok(objResult)); }
public async Task <IHttpActionResult> updateVaiTro([FromBody] VaiTro vaitro) { VaiTroRepository repo = new VaiTroRepository(_connectionString); vaitro.NgaySuaDT = DateTime.Now; var result = await repo.UpdatePartial(vaitro, nameof(VaiTro.MaVaiTro), nameof(VaiTro.TenVaiTro), nameof(VaiTro.MoTa), nameof(VaiTro.KhoaYN), nameof(VaiTro.NgaySuaDT) ); return(Content(HttpStatusCode.OK, result)); }
public async Task <IHttpActionResult> UpdateVaiTroTest(int id) { VaiTroRepository repo = new VaiTroRepository(_connectionString); VaiTro vaitro = await repo.GetById(id); if (vaitro == null) { return(Ok("khong tim thay nguoi dung")); } vaitro.TenVaiTro = Guid.NewGuid().ToString(); VaiTro objResult = await repo.UpdatePartial(vaitro, nameof(VaiTro.TenVaiTro) ); return(Ok(objResult)); }