Example #1
0
 public bool Insert(CaloriesDto calory)
 {
     try {
         _unitOfWork.TestRepository.Insert(calory.Adapt <Calories>());
         _unitOfWork.Commit();
         return(true);
     }
     catch (Exception error)
     {
         return(false);
     }
 }
Example #2
0
        public string Insert(CaloriesDto calory)
        {
            var validationResult = _validator.Validate(calory);

            if (!validationResult.IsValid)
            {
                return("");
            }

            try
            {
                _unitOfWork.TestRepository.Insert(calory.Adapt <Calories>());
                _unitOfWork.Commit();
                return("");
            }
            catch (Exception error)
            {
                return("false");
            }
        }