//Interface <pre>using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CoinJarAPI.Interface { interface ICoinJar { void AddCoin(ICoin coin); decimal GetTotalAmount(); void Reset(); } public interface ICoin { decimal Amount { get; set; } decimal Volume { get; set; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Web.Http; using CoinJarAPI.Models; namespace CoinJarAPI.Controllers { public class CoinJarController : ApiController { // GET: api/CoinJar public IEnumerable<CoinJarModel> Get() { var coinJarList = new List<CoinJarModel>(); for (int i = 0; i < 10; i++) { var coinjarModel = new CoinJarModel { // volume, Amount, GetTotalAmount. }; } return coinJarList; } // GET: api/CoinJar/5 public string Get(int id) { return "value"; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; using System.Web; namespace CoinJarAPI.Models { [DataContract] public class CoinJarModel { [DataMember(Name = "volume")] public decimal Volume { get; set; } [DataMember(Name = "amount")] public decimal Amount { get; set; } [DataMember(Name = "getTotalAmount")] public decimal GetTotalAmount { get; set; } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)