public Opportunity SaveOpportunity(Opportunity Opportunity) { Opportunity op = Opportunities.FirstOrDefault(v => v.id == Opportunity.id); if (op != null) { op.Name = Opportunity.Name; op.Center = Opportunity.Center; op.Date = Opportunity.Date; } return(op); }
public Opportunity CreateOpportunity(Opportunity Opportunity) { if (Opportunities.Count != 0) { Opportunity.id = Opportunities.Max(v => v.id) + 1; } else { Opportunity.id = 1; } Opportunities.Add(Opportunity); return(Opportunity); }