public bool Insert(CaloriesDto calory) { try { _unitOfWork.TestRepository.Insert(calory.Adapt <Calories>()); _unitOfWork.Commit(); return(true); } catch (Exception error) { return(false); } }
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"); } }