public HeSoNhanCong Add(HeSoNhanCong hsnc)
        {
            var check = _heSoNhanCongRepository.CheckContain(x => x.SoNguoiThucHien.Equals(hsnc.SoNguoiThucHien));

            if (!check)
            {
                return(_heSoNhanCongRepository.Add(hsnc));
            }
            else
            {
                throw new NameDuplicateException("Dữ liệu đã tồn tại ~");
            }
        }
        public HttpResponseMessage Created(HttpRequestMessage request, HeSoNhanCongViewModel hesoncVM)
        {
            return(CreateReponse(request, () =>
            {
                if (!ModelState.IsValid)
                {
                    return request.CreateResponse(HttpStatusCode.BadRequest, ModelState.IsValid);
                }
                else
                {
                    var hsnc = new HeSoNhanCong();
                    hsnc.UpdateNhanCong(hesoncVM);

                    var model = _heSoNhanCongService.Add(hsnc);
                    _heSoNhanCongService.save();
                    var responseData = Mapper.Map <HeSoNhanCong, HeSoNhanCongViewModel>(model);
                    return request.CreateResponse(HttpStatusCode.OK, responseData);
                }
            }));
        }
 public void Update(HeSoNhanCong hsnc)
 {
     _heSoNhanCongRepository.Update(hsnc);
 }
 public static void UpdateNhanCong(this HeSoNhanCong hsnc, HeSoNhanCongViewModel hsncVm)
 {
     hsnc.Id              = hsncVm.Id;
     hsnc.HeSoNcKcn       = hsncVm.HeSoNcKcn;
     hsnc.SoNguoiThucHien = hsncVm.SoNguoiThucHien;
 }