public static void TellForPersonAboutStartLot(int lotId) { Log.Logger("Work ServiceWork.TellForPersonAboutStartLot"); using (AuctionContent db = new AuctionContent()) { foreach (Tell elem in db.Tells.Where(elem => elem.Lot.Id == lotId)) { PersonWork.SendMessage(db.Persons.First(), "Lot is start", "We want to tell you about start lot " + elem.Lot.LotName + " NOW!!! Hurry up make your bet)", elem.Person); } } Log.Logger("Finish work ServiceWork.TellForPersonAboutStartLot"); }
public static bool AddLot(Lot lot, Person p) { try { using (AuctionContent db = new AuctionContent()) { db.Persons.Attach(p); lot.WhoSale = p; db.Lots.Add(lot); db.SaveChanges(); ServiceWork.TellAboutStartLot(lot); PersonWork.SendMessage(db.Persons.First(), "Auction", "Your lot " + lot.LotName + " is add. Wait for start)", p); return(true); } } catch (Exception ex) { Log.Logger(ex.Message); return(false); } }