public ActionResult Create(Storm.Business.ViewModels.HeroViewModel model, FormCollection f) { try { string HeroTypeId = ConvertStringArrayToString((string[])f.GetValue("HeroType").RawValue); if (HeroTypeId == string.Empty) { ModelState.AddModelError(string.Empty, "Hero Type not selected. Please chose one"); return(View(model)); } LoadHeroTypes(HeroTypeId); model.HeroType = _heroTypeAppService.GetById(ObjectId.Parse(HeroTypeId)); var validation = _heroAppService.Add(model); if (validation.IsValid) { ViewBag.Success = validation.Message; } else { foreach (var error in validation.Erros) { ModelState.AddModelError(string.Empty, error.Message); } } return(View(model)); } catch (Exception ex) { ModelState.AddModelError(string.Empty, ex.Message); return(View(model)); } }
// GET: api/HeroTypes/5 public HeroTypeViewModel Get(string id) { return(_heroTypeAppService.GetById(ObjectId.Parse(id))); }
// GET: HeroTypes/Details/5 public ActionResult Details(string id) { return(View(_heroTypeAppService.GetById(ObjectId.Parse(id)))); }