I need some help with my requirement to implement coin jar in c# using rest api. My requirement are as below;
"coin jar only accept latest us coinage, must have volume of 42 fluids ounces"
"must have a counter to keep track of the total amount of money collected"
"reset the count back to $0.00."
My logic so far is as follows in c# using rest api
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Net;
- using System.Net.Http;
- using System.Web.Http;
-
- namespace CoinJarAPI.Controllers
- {
- public class CoinJarController : ApiController
- {
-
- public IEnumerable<string> Get()
- {
- return new string[] { "value1", "value2" };
- }
-
-
- public string Get(int id)
- {
- return "value";
- }
-
-
- public void Post([FromBody]string value)
- {
- }
-
-
- public void Put(int id, [FromBody]string value)
- {
- }
-
-
- public void Delete(int id)
- {
- }
- }
- }
-
- 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 CoinJarAPI.Interface;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
-
- namespace CoinJarAPI.Repository
- {
- public class Repository : ICoinJar
- {
- public void AddCoin(ICoin coin)
- {
- throw new NotImplementedException();
- }
-
- public decimal GetTotalAmount()
- {
- throw new NotImplementedException();
- }
-
- public void Reset()
- {
- throw new NotImplementedException();
- }
- }
- }