public ActionResult PrintShoppingList(int weekNumber, string store, string type = "html")
 {
     var number = Extension.GetNextWeekNumber(weekNumber);
     using (var db = new FluentQuery(_dbFactory.OpenDbConnection()))
     {
         var accessor = new ShoppingAccessor(db);
         var shoppingList = accessor.GetShoppingListForStore(number, store);
         return type == "json" ? JsonCamelCase(shoppingList) : (ActionResult)View(shoppingList);
     }
 }
        private string CreateShoppingListEmail(int weekNumber, string store)
        {
            using (var db = new FluentQuery(_dbFactory.OpenDbConnection()))
            {
                var accessor = new ShoppingAccessor(db);
                var shoppingList = accessor.GetShoppingListForStore(weekNumber, store);

                //using (var templater = new IsolatedRazor.RazorTemplater(null))
                //{
                //    string result = templater.ParseAsync("MyTemplate", "<div>Hello @Model.Name! It is @DateTime.Now</div>", DateTime.Now, new { Name = "ModelTest" }).Result;
                //}
                //~/Static/PrintShoppingList.cshtml
                //"~/Views/Main/PrintShoppingList.cshtml"
                var templatePath = HttpContext.Current.Server.MapPath("~/Static/PrintShoppingList.cshtml");
                //var templatePath = HttpContext.Current.Server.MapPath("~/Views/Main/PrintShoppingList.cshtml");
                using (var templater = new IsolatedRazor.RazorTemplater(templatePath))
                {
                    var emailContent = templater.ParseAsync(PrintShoppingList, File.ReadAllText(templatePath), DateTime.Now, shoppingList).Result;
                    return emailContent;
                }
            }
        }
 public ActionResult ShoppingList(int weekNumber, bool update = false)
 {
     using (var db = new FluentQuery(_dbFactory.OpenDbConnection()))
     {
         var shoppingAccessor = new ShoppingAccessor(db);
         var shoppingList = update ? shoppingAccessor.Update(weekNumber) : shoppingAccessor.GetOrCreate(weekNumber);
         var model = new
         {
             parentId = shoppingList.Id,
             parentName = shoppingList.WeekNumber.ToWeekName(),
             weekNumber = shoppingList.WeekNumber,
             //published = shoppingList.Published
         }.ToExpando();
         return View(model);
     }
 }