示例#1
0
 private void Validate(incrementtype incrementType)
 {
     if (String.IsNullOrEmpty(incrementType.incrementTypeDescription))
     {
         throw new InvalidInputException("Increment description is required.");
     }
 }
示例#2
0
        public int Add(incrementtype incrementType)
        {
            var lastId = _db.incrementtypes.Max(i => i.incrementTypeId);

            incrementType.incrementTypeId = lastId + 1;
            _db.incrementtypes.Add(incrementType);
            _db.SaveChanges();
            return(incrementType.incrementTypeId);
        }
示例#3
0
        public void Update(incrementtype incrementType, int id)
        {
            var incrementTypeToUpdate = FindOne(id);

            if (incrementTypeToUpdate == null)
            {
                return;
            }
            incrementTypeToUpdate = incrementType;
            _db.SaveChanges();
        }
示例#4
0
        //Validation will take place in the other Add method's Validate method
        //And in IncrementService validate
        public void Add(ReminderAggregate reminderAggregate)
        {
            var reminder = new reminder()
            {
                reminderDate = reminderAggregate.ReminderDate,
                remindercol  = reminderAggregate.ReminderCol,
                createdBy    = _authRepository.Username
            };

            var incrementType = new incrementtype()
            {
                incrementTypeDescription = reminderAggregate.IncrementDescription
            };

            var incrementId = incrementService.Add(incrementType);

            reminder.snoozeIncrementTypeId = incrementId;

            Add(reminder);
        }
示例#5
0
 public void Update(incrementtype incrementType, int id)
 {
     Validate(incrementType);
     FindOne(id);
     _repository.Update(incrementType, id);
 }
示例#6
0
 public int Add(incrementtype incrementType)
 {
     Validate(incrementType);
     return(_repository.Add(incrementType));
 }