예제 #1
0
        public async Task <IHttpActionResult> deleteVaiTro(int Id)
        {
            VaiTroRepository repo = new VaiTroRepository(_connectionString);
            var result            = await repo.Delete(Id);

            return(Content(HttpStatusCode.OK, result));
        }
예제 #2
0
        public async Task <IHttpActionResult> GetListVaiTroByProjection()
        {
            VaiTroRepository repo = new VaiTroRepository(_connectionString);

            IEnumerable <dynamic> listVaiTro = await repo.SelectAllByCriteriaProjection("VaiTroId,HoTen", "", "", 1, 2);

            return(Ok(listVaiTro));
        }
예제 #3
0
        public async Task <IHttpActionResult> GetListVaiTroByCriteriaCount()
        {
            VaiTroRepository repo = new VaiTroRepository(_connectionString);

            int listVaiTro = await repo.SelectAllByCriteriaCount("");

            return(Ok(listVaiTro));
        }
예제 #4
0
        public async Task <IHttpActionResult> GetListVaiTroByCriteria()
        {
            VaiTroRepository repo = new VaiTroRepository(_connectionString);

            IEnumerable <VaiTro> listVaiTro = await repo.SelectAllByCriteria("", "");

            return(Content(HttpStatusCode.OK, listVaiTro));
        }
예제 #5
0
        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);
        }
예제 #6
0
        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));
        }
예제 #7
0
        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));
        }
예제 #8
0
        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));
        }
예제 #9
0
파일: Unitofwork.cs 프로젝트: mvhix9/OOAD
 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);
 }
예제 #10
0
        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));
        }
예제 #11
0
        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));
        }
예제 #12
0
        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));
        }