public bool Save(risTabulky risContext) { bool success = false; try { if (id_typu == -1) // INSERT { this.FillEntity(); risContext.typ_jedla.Add(entityTypJedla); risContext.SaveChanges(); this.FillBObject(); success = true; } else // UPDATE { var temp = from a in risContext.typ_jedla where a.id_typu == id_typu select a; entityTypJedla = temp.Single(); this.FillEntity(); risContext.SaveChanges(); success = true; } } catch (Exception ex) { throw new ApplicationException(String.Format("{0}.{1}", this.GetType(), "Save()"), ex); } return(success); }
public BTyp_jedla(typ_jedla tj) { id_typu = tj.id_typu; typ = tj.typ; text = new BText(tj.text); entityTypJedla = tj; }
public void Reset() { id_typu = -1; typ = 0; text = new BText(); jedlo = new List <BJedlo>(); entityTypJedla = new typ_jedla(); }
public bool Get(risTabulky risContext, int id) { bool success = false; try { var temp = from a in risContext.typ_jedla where a.id_typu == id select a; entityTypJedla = temp.Single(); this.FillBObject(); success = true; } catch (Exception ex) { throw new ApplicationException(String.Format("{0}.{1}", this.GetType(), "Get()"), ex); } return(success); }