public ActionResult <List <Topping> > Get() { try { return(toppingService.GetAll()); } catch (Exception exception) { return(new ObjectResult(new { Status = 500, Value = exception.Message })); } }
public void TestGetAll() { var testToppingEntity = new ToppingEntity() { Name = "TestName" }; List <ToppingEntity> toppingEntityList = new List <ToppingEntity>() { testToppingEntity }; toppingRepositoryMock.Setup(m => m.GetAll()) .Returns(toppingEntityList); var result = sut.GetAll(); Assert.AreEqual(toppingEntityList.Count, result.Count); }
public ActionResult Index() { var response = new HomeControllerIndexData { Pizzas = _pizzaSizeService.GetAll().Pizzas, Form = new FormModel { ExtraToppings = _toppingService.GetAll().Toppings.ToDictionary(x => x, y => false), Sizes = _sizeService.GetAll().Sizes.ToDictionary(x => x, y => false) } }; if (Session["UserId"] == null) { Session["UserId"] = _userSessionService.NewUser(); } else { response.Total = _userSessionService.GetBasketTotalForUser(Session["UserId"].ToString()); response.LoggedIn = _userSessionService.IsLoggedIn(Session["UserId"].ToString()); } return(View(response)); }
public IHttpActionResult GetAll() { return(Ok(_toppingService.GetAll())); }