public int TotalProfit() { int profit = 0; Cashiers.ForEach(cashier => profit += cashier.TotalProfitFromAllTickets()); return(profit); }
public string AddCashiers(Posts post, Cashiers cashiers) { if (!context.Posts.Any(p => p.Login == post.Login)) { context.Posts.Add(post); context.SaveChanges(); cashiers.id_post = context.Posts.ToList().Last().id; //связка табл context.Cashiers.Add(cashiers); context.SaveChanges(); return("Кассир добавлен!"); } return("Такой кассир уже существует!"); }