public bool Del(risTabulky risContext) { bool success = false; try { var temp = risContext.jedlo_surovina.First(i => i.id_jedla == id_jedla && i.id_surovina == id_surovina); risContext.jedlo_surovina.Remove(temp); risContext.SaveChanges(); success = true; this.Reset(); } catch (Exception ex) { throw new ApplicationException(String.Format("{0}.{1}", this.GetType(), "Del()"), ex); } return success; }
public static BUcet dajUcet(String login, risTabulky risContext) { return new BUcet(risContext.ucet.First(p => p.login==(login))); }
public static BTyp_jedla dajTypJedla(int id, risTabulky risContext) { return new BTyp_jedla(risContext.typ_jedla.First(p => p.id_typu == id)); }
public static BSurovina dajSurovinu(int id, risTabulky risContext) { return new BSurovina(risContext.surovina.First(p => p.id_surovina == id)); }
public static BJedlo dajJedlo(int id, risTabulky risContext) { return new BJedlo(risContext.jedlo.First(p => p.id_jedla == id)); }
public bool Save(risTabulky risContext) { bool success = false; try { if (id_jedla == -1 && id_surovina == -1) // INSERT { this.FillEntity(); risContext.jedlo_surovina.Add(entityJedloSurovina); risContext.SaveChanges(); this.FillBObject(); success = true; } else // UPDATE { var temp = from a in risContext.jedlo_surovina where a.id_jedla == id_jedla && a.id_surovina==id_surovina select a; entityJedloSurovina = 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 bool Get(risTabulky risContext, int id) { bool success = false; try { var temp = from a in risContext.jedlo_surovina where a.id_jedla == id_jedla && a.id_surovina == id_surovina select a; entityJedloSurovina = temp.Single(); this.FillBObject(); success = true; } catch (Exception ex) { throw new ApplicationException(String.Format("{0}.{1}", this.GetType(), "Get()"), ex); } return success; }
/// <summary> /// Vytvorí nový zoznam prihlasených uživateľov /// </summary> /// <param name="risContext">kontext databázy</param> public Sessions(risTabulky risContext) { this.risContext = risContext; }
public DBDataExecutor() { aRisContext = new risTabulky(); }