Ejemplo n.º 1
0
        public FizzBuzzServiceResponse GetHistoryOfOperations()
        {
            var result = new FizzBuzzServiceResponse();
            var operationsInDb = uow.OperationRepository.Get();

            foreach (var operation in operationsInDb)
            {
                result.ServiceCallResults.Add(new OperationDTO(operation));
            }

            return result;
        }
Ejemplo n.º 2
0
        public FizzBuzzServiceResponse CreateRecordOfOperation(string typeOfObjectToUse, string lowValue, string highValue)
        {
            var result = new FizzBuzzServiceResponse();
            Operation newRecordOfOperation;

            var listOfTypesSelected = new List<object>()
            {
                ServicesHelpers.TypeFactory(typeOfObjectToUse)
            };

            var fizzBuzzResult = FizzBuzz.Run(listOfTypesSelected, Int32.Parse(lowValue), Int32.Parse(highValue));
            newRecordOfOperation = ProcessRequest(typeOfObjectToUse, lowValue, highValue, fizzBuzzResult[0]);
            result.ServiceCallResults.Add(new OperationDTO(newRecordOfOperation));

            uow.OperationRepository.Insert(newRecordOfOperation);
            uow.Commit();

            return result;
        }