예제 #1
0
 public IngridientModel(IngridientModel ingridient)
 {
     ID          = ingridient.ID;
     Name        = ingridient.Name;
     UnitID      = ingridient.UnitID;
     Price       = ingridient.Price;
     ImageSource = ingridient.ImageSource;
 }
예제 #2
0
        public static void UpdateDatabase(IngridientModel ingridient)
        {
            IDatabase sqldb = new SQLDatabase();

            try
            {
                sqldb.Open();
                sqldb.ExcuteNonQuery("UPDATE NGUYENLIEU SET TenNguyenLieu = N'" + ingridient.Name + "', MaDonViTinh='" + ingridient.UnitID + "', TriGia=" + ingridient.Price + ", HinhAnh='" + ingridient.ImageSource + "' WHERE MaNguyenLieu='" + ingridient.ID + "'");
            }
            catch (SqlException e)
            {
                Debug.LogOutput("SqlException in IngridientModel >> " + e.ToString());
            }
            finally
            {
                sqldb.Close();
            }
        }