Пример #1
0
        public HeSoTg Add(HeSoTg hstg)
        {
            var check = _heSoThoiGianRepository.CheckContain(x => x.ThoiGianDk.Equals(hstg.ThoiGianDk));

            if (!check)
            {
                return(_heSoThoiGianRepository.Add(hstg));
            }
            else
            {
                throw new NameDuplicateException("Dữ liệu đã tồn tại ~");
            }
        }
Пример #2
0
        public HttpResponseMessage Created(HttpRequestMessage request, HeSoTgViewModel hesotgVM)
        {
            return(CreateReponse(request, () =>
            {
                if (!ModelState.IsValid)
                {
                    return request.CreateResponse(HttpStatusCode.BadRequest, ModelState.IsValid);
                }
                else
                {
                    var hstg = new HeSoTg();
                    hstg.UpdateHeSoTg(hesotgVM);

                    var model = _heSoThoiGianService.Add(hstg);
                    _heSoThoiGianService.save();
                    var responseData = Mapper.Map <HeSoTg, HeSoTgViewModel>(model);
                    return request.CreateResponse(HttpStatusCode.OK, responseData);
                }
            }));
        }
 public static void UpdateHeSoTg(this HeSoTg hstg, HeSoTgViewModel hstgVm)
 {
     hstg.Id         = hstgVm.Id;
     hstg.ThoiGianDk = hstgVm.ThoiGianDk;
     hstg.HeSoTgdk   = hstgVm.HeSoTgdk;
 }
Пример #4
0
 public void Update(HeSoTg hstg)
 {
     _heSoThoiGianRepository.Update(hstg);
 }