public ActionResult CreateComment(CreateCommentModel model) { try { if (ModelState.IsValid) { if (CurrenciesManager.CurrencyExists(model.Currency)) { return(Json(CurrenciesManager.CreateComment(model.Currency, model.Message, model.Vote, Username), JsonRequestBehavior.AllowGet)); } else { return(new HttpStatusCodeResult(HttpStatusCode.NotFound)); } } else { return(new HttpStatusCodeResult(HttpStatusCode.Forbidden)); } } catch { return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError)); } }
public ActionResult Currency(string id) // id = shortCode { IncludeMenu("currencies"); if (CurrenciesManager.CurrencyExists(id)) { return(View(CurrenciesManager.GetCurrencyBySymbol(id).Id)); } else { return(RedirectToAction("Index")); } }
public ActionResult GetCurrency(string id) // id = currency id { try { if (Guid.TryParse(id, out Guid currencyId) && CurrenciesManager.CurrencyExists(currencyId)) { return(Json(CurrenciesManager.GetCurrencyById(currencyId), JsonRequestBehavior.AllowGet)); } else { return(new HttpStatusCodeResult(HttpStatusCode.NotFound)); } } catch { return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError)); } }