public HttpResponseMessage Patch(Guid collectionId, CoinViewModel coin) { try { CoinFacade.UpdateCoin(collectionId, Mapper.Map <CoinDto>(coin)); return(new HttpResponseMessage(HttpStatusCode.Accepted)); } catch { return(new HttpResponseMessage(HttpStatusCode.InternalServerError)); } }
public HttpResponseMessage Put(Guid collectionId, CoinViewModel coin) { try { coin.Country = "United States"; CoinFacade.CreateCoin(collectionId, Mapper.Map <CoinDto>(coin)); return(new HttpResponseMessage(HttpStatusCode.Created)); } catch { return(new HttpResponseMessage(HttpStatusCode.InternalServerError)); } }
public HttpResponseMessage Delete([FromBody] Guid coinId) { try { CoinFacade.Delete(coinId); return(new HttpResponseMessage(HttpStatusCode.Accepted)); } catch { return(new HttpResponseMessage(HttpStatusCode.InternalServerError)); } }
public JsonResult Get(Guid collectionId) { var coins = CoinFacade.GetCoinList(collectionId).Select(Mapper.Map <CoinViewModel>).ToList(); return(new JsonResult(coins)); }