public ActionResult Create(BeerView beer) { try { if (beer.Growler && beer.TastingRoom) { var result1 = mongoService.AddBeerGrowler(beer); var result2 = mongoService.AddBeerTastingRoom(beer); } else if (beer.Growler) { var result = mongoService.AddBeerGrowler(beer); } else if (beer.TastingRoom) { var result = mongoService.AddBeerTastingRoom(beer); } Brewery brewery = mongoService.GetBrewery(beer.id); return(RedirectToAction("Index", "Brewery")); } catch { return(View()); } }
public ActionResult NewBeer(string id, BeerView beer) { beer.id = id; if (beer.Growler) { var result = mongoService.AddBeerGrowler(beer); } if (beer.TastingRoom) { var result = mongoService.AddBeerTastingRoom(beer); } Brewery brewery = mongoService.GetBrewery(id); return(View(brewery)); }