public RecipeFermentable(Recipe recipe, IFermentable fermentable, Weight weight, decimal pppg) : base(fermentable.Name) { this.recipe = recipe; this.fermentable = fermentable; this.weight = weight; this.pppg = pppg; }
public virtual void AddFermentable(IFermentable fermentable, Weight weight, decimal pppg) { if (grains.Count > 0) { var existing = grains.SingleOrDefault(x => x.Name == fermentable.Name && x.Pppg == pppg); if (existing != null) existing.IncreaseWeight(weight); else grains.Add(new RecipeFermentable(this, fermentable, weight, pppg)); } else grains.Add(new RecipeFermentable(this, fermentable, weight, pppg)); }
public Guid Save(IFermentable fermentable) { using(var tran = Session.BeginTransaction()) { try { _session.SaveOrUpdate(fermentable); tran.Commit(); } catch (Exception) { tran.Rollback(); _session.Close(); _session.Dispose(); _session = null; } } return fermentable.Id; }
//public FermentableViewModel() //{ // this._fermentable = new Fermentable(""); //} public FermentableViewModel(IFermentable fermentable) { _fermentable = fermentable; }