public ActionResult Index(ComponentPresentation componentPresentation) { ShoppingList model = new ShoppingList { componentPresentation = componentPresentation, items = this.shoppinglistrepository.GetShoppingListItemsByProject(base.User.Identity.Name) }; return base.View(model); }
public ActionResult ShoppingListPrint() { ShoppingList model = new ShoppingList(); if (base.User.Identity.IsAuthenticated) { model.items = this.shoppinglistrepository.GetShoppingListItemsByProject(base.User.Identity.Name); return base.View(model); } return base.View(model); }
public ActionResult EmailShoppingList(ComponentPresentation componentPresentation, string EmailButton) { ShoppingListEmail email = new ShoppingListEmail { items = this.shoppinglistrepository.GetShoppingListItemsByProduct(base.User.Identity.Name), itemHtml = "\n\n" }; string projectName = string.Empty; foreach (IGrouping<string, ShoppingListItem> grouping in email.items) { int num = 0; foreach (ShoppingListItem item in grouping) { num += item.Quantity; } if (num != 0) { string itemHtml; if (projectName != grouping.First<ShoppingListItem>().ProjectName) { itemHtml = email.itemHtml; email.itemHtml = itemHtml + Helper.GetResource("ShoppingListProject") + ": " + grouping.First<ShoppingListItem>().ProjectName + "\n\n"; } itemHtml = email.itemHtml; email.itemHtml = itemHtml + Helper.GetResource("ShoppingListProduct") + ": " + grouping.First<ShoppingListItem>().ProductName + "\n"; itemHtml = email.itemHtml; email.itemHtml = itemHtml + Helper.GetResource("ShoppingListBrand") + ": " + grouping.First<ShoppingListItem>().Brand + "\n"; object obj2 = email.itemHtml; email.itemHtml = string.Concat(new object[] { obj2, Helper.GetResource("ShoppingListQuantity"), ": ", num, "\n" }); email.itemHtml = email.itemHtml + "\n"; } projectName = grouping.First<ShoppingListItem>().ProjectName; } email.itemHtml = email.itemHtml + "\n"; email.EmailAddress = base.User.Identity.Name; bool flag = this.shoppinglistrepository.SendShoppingListEmail(email); ShoppingList model = new ShoppingList { componentPresentation = componentPresentation, items = this.shoppinglistrepository.GetShoppingListItemsByProject(base.User.Identity.Name) }; if (base.Request.IsAjaxRequest()) { var data = new { success = flag }; return base.Json(data, JsonRequestBehavior.AllowGet); } return base.View(model); }