示例#1
0
 public static void UpdateDaoTaoLienTuc(this DaoTaoLienTuc daoTaoLienTuc, DaoTaoLienTucViewModel daoTaoLienTucVm)
 {
     daoTaoLienTuc.ID           = daoTaoLienTucVm.ID;
     daoTaoLienTuc.IDHinhThuc   = daoTaoLienTucVm.IDHinhThuc;
     daoTaoLienTuc.MaKhoaPhong  = daoTaoLienTucVm.MaKhoaPhong;
     daoTaoLienTuc.MaNhanVien   = daoTaoLienTucVm.MaNhanVien;
     daoTaoLienTuc.NoiDung      = daoTaoLienTucVm.NoiDung;
     daoTaoLienTuc.SoTiet       = daoTaoLienTucVm.SoTiet;
     daoTaoLienTuc.NgayCapNhat  = daoTaoLienTucVm.NgayCapNhat;
     daoTaoLienTuc.NguoiCapNhat = daoTaoLienTucVm.NguoiCapNhat;
     daoTaoLienTuc.NgayTao      = daoTaoLienTucVm.NgayTao;
     daoTaoLienTuc.NguoiTao     = daoTaoLienTucVm.NguoiTao;
     daoTaoLienTuc.xoa          = daoTaoLienTucVm.xoa;
 }
示例#2
0
        public HttpResponseMessage Put(HttpRequestMessage request, DaoTaoLienTucViewModel daoTaoLienTucVm)
        {
            return(CreateHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;
                if (ModelState.IsValid)
                {
                    DaoTaoLienTuc dbDaoTaoLienTuc = _daoTaoLienTucService.GetById(daoTaoLienTucVm.ID);
                    dbDaoTaoLienTuc.UpdateDaoTaoLienTuc(daoTaoLienTucVm);
                    dbDaoTaoLienTuc.NgayCapNhat = DateTime.Now;
                    dbDaoTaoLienTuc.NguoiCapNhat = User.Identity.Name;
                    _daoTaoLienTucService.Update(dbDaoTaoLienTuc);
                    _daoTaoLienTucService.SaveChanges();

                    var responseData = Mapper.Map <DaoTaoLienTucViewModel>(dbDaoTaoLienTuc);
                    response = request.CreateResponse(HttpStatusCode.Created, responseData);
                }
                else
                {
                    request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
                }
                return response;
            }));
        }
示例#3
0
        public HttpResponseMessage Post(HttpRequestMessage request, DaoTaoLienTucViewModel daoTaoLienTucVm)
        {
            return(CreateHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;
                if (ModelState.IsValid)
                {
                    DaoTaoLienTuc newDaoTaoLienTuc = new DaoTaoLienTuc();
                    newDaoTaoLienTuc.UpdateDaoTaoLienTuc(daoTaoLienTucVm);
                    newDaoTaoLienTuc.NgayTao = DateTime.Now;
                    newDaoTaoLienTuc.NguoiTao = User.Identity.Name;
                    var daoTaoLienTuc = _daoTaoLienTucService.Add(newDaoTaoLienTuc);
                    _daoTaoLienTucService.SaveChanges();

                    var responseData = Mapper.Map <DaoTaoLienTucViewModel>(daoTaoLienTuc);
                    response = request.CreateResponse(HttpStatusCode.Created, responseData);
                }
                else
                {
                    request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
                }
                return response;
            }));
        }
示例#4
0
 public void Update(DaoTaoLienTuc daoTaoLienTuc)
 {
     _daoTaoLienTucRepository.Update(daoTaoLienTuc);
 }
示例#5
0
 public DaoTaoLienTuc Add(DaoTaoLienTuc daoTaoLienTuc)
 {
     return(_daoTaoLienTucRepository.Add(daoTaoLienTuc));
 }