public AddtoListPage()
 {
     InitializeComponent();
     Shell.SetTabBarIsVisible(this, false);
     // Binds the context to the variables stored in ShoppingListView
     BindingContext = new ShoppingListView();
 }
Beispiel #2
0
        public void It_renders_all_rows()
        {
            var mocker = new AutoMocker();
            var items  = new []
            {
                new ShoppingListItem("Coffee", 1),
                new ShoppingListItem("Eggs", 12)
            };
            var name = "Test Shopping List";

            var shoppingList = mocker.GetMock <IShoppingList>();

            shoppingList.Setup(x => x.Items).Returns(items);
            shoppingList.Setup(x => x.ListName).Returns(name);

            var view = new ShoppingListView(shoppingList.Object);

            view.Render(new ConsoleRenderer(_terminal, OutputMode.NonAnsi), new Region(0, 0, 100, 7));

            var lines = _terminal.RenderOperations();

            lines
            .Should()
            .BeEquivalentSequenceTo(
                Cell(name, 0, 0),
                Cell("#   ", 0, 2), Cell("Items to Purchase", 4, 2),
                Cell("1   ", 0, 3), Cell("Coffee           ", 4, 3),
                Cell("12  ", 0, 4), Cell("Eggs             ", 4, 4)
                );
        }
Beispiel #3
0
 public ShoppingListPage()
 {
     InitializeComponent();
     BindingContext = new ShoppingListView();
     selectedItem   = null;
     Today          = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
     ExpDate        = Today.Date.ToString("MM/dd");
 }
Beispiel #4
0
        public ActionResult DeleteConfirmed(int id)
        {
            ShoppingListView shoppingListView = db.ShoppingListViews.Find(id);

            db.ShoppingListViews.Remove(shoppingListView);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #5
0
    public void NotifyPropertyChanged()
    {
        ShoppingListView view = gameObject.transform.parent.transform.parent.GetComponent <ShoppingListView>();

        if (null != view)
        {
            view.CalculateTotal();
        }
    }
Beispiel #6
0
 public ActionResult Edit([Bind(Include = "id,UserId,Name,Color,CreatedUtc,ModifiedUtc")] ShoppingListView shoppingListView)
 {
     if (ModelState.IsValid)
     {
         db.Entry(shoppingListView).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(shoppingListView));
 }
Beispiel #7
0
        // GET: ShoppingListViews/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ShoppingListView shoppingListView = db.ShoppingListViews.Find(id);

            if (shoppingListView == null)
            {
                return(HttpNotFound());
            }
            return(View(shoppingListView));
        }