public static void UpdateKyThuatXN(this DanhMucKyThuatXN kythuatXN, DanhMucKyThuatXNViewModel kythuatXNVM)
 {
     kythuatXN.RowIDKyThuatXn    = kythuatXNVM.RowIDKyThuatXn;
     kythuatXN.IDKyThuatXN       = kythuatXNVM.IDKyThuatXN;
     kythuatXN.TenHienThiKyThuat = kythuatXNVM.TenHienThiKyThuat;
     kythuatXN.TenKyThuat        = kythuatXNVM.TenKyThuat;
     kythuatXN.isLocked          = kythuatXNVM.isLocked ?? false;
     kythuatXN.STT = kythuatXNVM.STT;
 }
        public void Update(DanhMucKyThuatXN dmKyThuatXN)
        {
            DanhMucKyThuatXN dm = dmKyThuatXNRepository.GetMulti(x => x.IDKyThuatXN == dmKyThuatXN.IDKyThuatXN).FirstOrDefault();

            if (dm != null)
            {
                dmKyThuatXNRepository.Update(dmKyThuatXN);
            }
            else
            {
                dmKyThuatXNRepository.Add(dmKyThuatXN);
            }
        }
        public HttpResponseMessage Create(HttpRequestMessage request, DanhMucKyThuatXNViewModel dmKyThuatXNVM)
        {
            return(CreateHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;
                if (!ModelState.IsValid)
                {
                    response = request.CreateResponse(HttpStatusCode.BadRequest, ModelState);
                }
                else
                {
                    var newKyThuat = new DanhMucKyThuatXN();
                    newKyThuat.UpdateKyThuatXN(dmKyThuatXNVM);
                    dmKyThuatXNService.Create(newKyThuat);
                    dmKyThuatXNService.Save();

                    var responseData = Mapper.Map <DanhMucKyThuatXN, DanhMucKyThuatXNViewModel>(newKyThuat);
                    response = request.CreateResponse(HttpStatusCode.Created, responseData);
                }

                return response;
            }));
        }
 public void Create(DanhMucKyThuatXN dmKyThuatXN)
 {
     dmKyThuatXNRepository.Add(dmKyThuatXN);
 }