-
- 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; }
- }
- }
-
-
- 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
- {
-
- public IEnumerable<CoinJarModel> Get()
- {
- var coinJarList = new List<CoinJarModel>();
- for (int i = 0; i < 10; i++)
- {
- var coinjarModel = new CoinJarModel
- {
-
- };
- }
- return coinJarList;
- }
-
-
- public string Get(int id)
- {
- return "value";
- }
-
- }
- }
-
- 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; }
- }
- }
Hi Team
I want to expose 3 endpoints that will do this following and this is what i have currently, question where do i implement these endpoints? Controller or Interface, do i have create a Model? Need some advice
Add a coin
Get the total amount of coins
Reset the coins