Exemplo n.º 1
0
 // PUT: api/RegTraining/5
 public bool Put(int id, [FromBody] RegTrainingEntity RegTrainingEntity)
 {
     if (id > 0)
     {
         return(_RegTrainingServices.UpdateRegTraining(id, RegTrainingEntity));
     }
     return(false);
 }
Exemplo n.º 2
0
 public int CreateRegTraining(RegTrainingEntity regTrainingEntity)
 {
     using (var scope = new TransactionScope())
     {
         var regTraining = new RegTraining()
         {
             regId      = regTrainingEntity.regId,
             trainingId = regTrainingEntity.trainingId,
         };
         _unitOfWork.RegTrainingRepository.Insert(regTraining);
         _unitOfWork.Save();
         scope.Complete();
         return(regTraining.id);
     }
 }
Exemplo n.º 3
0
        public bool UpdateRegTraining(int regTrainingId, RegTrainingEntity regTrainingEntity)
        {
            var success = false;

            if (regTrainingEntity != null)
            {
                using (var scope = new TransactionScope())
                {
                    var regTraining = _unitOfWork.RegTrainingRepository.GetByID(regTrainingId);
                    if (regTraining != null)
                    {
                        regTraining.regId      = regTrainingEntity.regId;
                        regTraining.trainingId = regTrainingEntity.trainingId;
                        _unitOfWork.Save();
                        scope.Complete();
                        success = true;
                    }
                }
            }
            return(success);
        }
Exemplo n.º 4
0
 // POST: api/RegTraining
 public int Post([FromBody] RegTrainingEntity RegTrainingEntity)
 {
     return(_RegTrainingServices.CreateRegTraining(RegTrainingEntity));
 }