public Investment Card([FromBody] int id) { if (id <= 0) { throw new ArgumentOutOfRangeException(nameof(id)); } var model = _investementRepository.Get(id); if (model == null) { throw new InvalidOperationException(); } return(model); }
/// <summary> /// /// </summary> /// <returns></returns> public Result <List <Domain.Entities.Investment> > Get() { Result <List <Domain.Entities.Investment> > result = new Result <List <Domain.Entities.Investment> >(); result.Content = new List <Domain.Entities.Investment>(); try { foreach (var invest in _investmentRepository.Get()) { result.Content.Add(Converters.ConvertInvestmentToModel(invest)); } result = Result <List <Domain.Entities.Investment> > .ReturnMessageCollect("Sucess", result.Content); } catch (Exception ex) { result = Result <List <Domain.Entities.Investment> > .ReturnMessageCollect(ex.Message, null); } return(result); }