public bool TryRemoveGrupoDeGasto(ref GrupoGastos grupo) { if (this.Aceptado || !this.GruposDeGasto.Contains(grupo)) { return(false); } this._GruposDeGasto.RemoveAt(this.GruposDeGasto.IndexOf(grupo)); this._Total -= grupo.Importe; return(true); }
/// <summary> /// No añade (y devuelve false) si el presupuesto está aceptado o grupo ya está añadido a this presupuesto /// </summary> /// <param name="grupo"></param> /// <returns></returns> public bool TryAddGrupoDeGasto(ref GrupoGastos grupo) { if (this.Aceptado || GruposDeGasto.Contains(grupo)) { return(false); } this._GruposDeGasto.Add(grupo); this._Total += grupo.Importe; return(true); }