Exemplo n.º 1
0
 // PUT: api/RegGoals/5
 public bool Put(int id, [FromBody] RegGoalsEntity RegGoalsEntity)
 {
     if (id > 0)
     {
         return(_RegGoalsServices.UpdateRegGoals(id, RegGoalsEntity));
     }
     return(false);
 }
Exemplo n.º 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);
     }
 }
Exemplo n.º 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);
        }
Exemplo n.º 4
0
 // POST: api/RegGoals
 public int Post([FromBody] RegGoalsEntity RegGoalsEntity)
 {
     return(_RegGoalsServices.CreateRegGoals(RegGoalsEntity));
 }