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; }
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; })); }
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; })); }
public void Update(DaoTaoLienTuc daoTaoLienTuc) { _daoTaoLienTucRepository.Update(daoTaoLienTuc); }
public DaoTaoLienTuc Add(DaoTaoLienTuc daoTaoLienTuc) { return(_daoTaoLienTucRepository.Add(daoTaoLienTuc)); }