public HttpResponseMessage Create(HttpRequestMessage request, DanhMucThongSoXNViewModel thongsoxetnghiemVm)
        {
            return(CreateHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;
                if (!ModelState.IsValid)
                {
                    response = request.CreateResponse(HttpStatusCode.BadRequest, ModelState);
                }
                else
                {
                    if (thongsoxetnghiemVm.isLocked == null)
                    {
                        thongsoxetnghiemVm.isLocked = false;
                    }
                    var newThongSo = new DanhMucThongSoXN();
                    newThongSo.UpdateThongSoXN(thongsoxetnghiemVm);
                    danhMucThongSoXNService.Add(newThongSo);
                    danhMucThongSoXNService.Save();

                    var responseData = Mapper.Map <DanhMucThongSoXN, DanhMucThongSoXNViewModel>(newThongSo);
                    response = request.CreateResponse(HttpStatusCode.Created, responseData);
                }

                return response;
            }));
        }
 public static void UpdateMapsKT_TS(this MapsXN_ThongSo maps, DanhMucThongSoXN thongso)
 {
     maps.RowIDMaps   = thongso.RowIDThongSo;
     maps.IDThongSoXN = thongso.IDThongSoXN;
     maps.TenThongSo  = thongso.TenThongSo;
     maps.IDKyThuatXN = "";
 }
Beispiel #3
0
 public void Update(DanhMucThongSoXN dmThongSo)
 {
     if (!string.IsNullOrEmpty(dmThongSo.MaDVCS))
     {
         dmThongSo.MaTrungTam = this.danhMucDonViCSRepository.GetMaTrungTamByMaDonViCS(dmThongSo.MaDVCS);
     }
     danhMucThongSoXNRepository.Update(dmThongSo);
 }
 public static void UpdateThongSoXN(this DanhMucThongSoXN thongso, DanhMucThongSoXNViewModel thongsoVm)
 {
     thongso.RowIDThongSo       = thongsoVm.RowIDThongSo;
     thongso.IDThongSoXN        = thongsoVm.IDThongSoXN;
     thongso.TenThongSo         = thongsoVm.TenThongSo;
     thongso.MaDonViTinh        = thongsoVm.MaDonViTinh;
     thongso.GiaTriMinNu        = thongsoVm.GiaTriMinNu;
     thongso.GiaTriMaxNu        = thongsoVm.GiaTriMaxNu;
     thongso.GiaTriTrungBinhNu  = thongsoVm.GiaTriTrungBinhNu;
     thongso.GiaTriMacDinh      = thongsoVm.GiaTriMacDinh;
     thongso.GiaTriMinNam       = thongsoVm.GiaTriMinNam;
     thongso.GiaTriMaxNam       = thongsoVm.GiaTriMaxNam;
     thongso.GiaTriTrungBinhNam = thongsoVm.GiaTriTrungBinhNam;
     thongso.MaNhom             = thongsoVm.MaNhom;
     thongso.Stt        = thongsoVm.Stt;
     thongso.GiaTri     = thongsoVm.GiaTri;
     thongso.isLocked   = thongsoVm.isLocked;
     thongso.DonViTinh  = thongsoVm.DonViTinh;
     thongso.MaDVCS     = thongsoVm.MaDVCS;
     thongso.MaTrungTam = thongsoVm.MaTrungTam;
 }