示例#1
0
        public void SetModel()
        {
            dao = new GroceryDao();
            Grocery g = dao.GetById(Id);

            this.Id         = g.Id;
            this.Name       = g.Name;
            this.Price      = g.Price;
            this.CategoryId = g.CategoryId;
            this.Unit       = g.Unit;
            this.InBasket   = g.InBasket;
            this.Category   = Category.GetCategories().First(x => x.Id == this.CategoryId);
        }
示例#2
0
        public void AddOrUpdate()
        {
            dao = new GroceryDao();

            if (dao.GetById(Id) == null)
            {
                dao.Insert(this);
            }
            else
            {
                dao.Update(this);
            }
        }