// PUT: api/RegGoals/5
 public bool Put(int id, [FromBody] RegGoalsEntity RegGoalsEntity)
 {
     if (id > 0)
     {
         return(_RegGoalsServices.UpdateRegGoals(id, RegGoalsEntity));
     }
     return(false);
 }
Example #2
0
 public int CreateRegGoals(RegGoalsEntity regGoalsEntity)
 {
     using (var scope = new TransactionScope())
     {
         var regGoals = new RegGoal()
         {
             regId  = regGoalsEntity.regId,
             goalId = regGoalsEntity.goalId
         };
         _unitOfWork.RegGoalRepository.Insert(regGoals);
         _unitOfWork.Save();
         scope.Complete();
         return(regGoals.id);
     }
 }
Example #3
0
        public bool UpdateRegGoals(int regGoalsId, RegGoalsEntity regGoalsEntity)
        {
            var success = false;

            if (regGoalsEntity != null)
            {
                using (var scope = new TransactionScope())
                {
                    var regGoals = _unitOfWork.RegGoalRepository.GetByID(regGoalsId);
                    if (regGoals != null)
                    {
                        regGoals.regId  = regGoalsEntity.regId;
                        regGoals.goalId = regGoalsEntity.goalId;
                        _unitOfWork.Save();
                        scope.Complete();
                        success = true;
                    }
                }
            }
            return(success);
        }
 // POST: api/RegGoals
 public int Post([FromBody] RegGoalsEntity RegGoalsEntity)
 {
     return(_RegGoalsServices.CreateRegGoals(RegGoalsEntity));
 }