示例#1
0
文件: Db.cs 项目: kvchernyaev/Pochta
 public List <IncomingRequest> GetIncomingRequests(int?top)
 {
     using (var db = new PochtaDbContext())
     {
         var i = db.IncomingRequests.OrderByDescending(x => x.Id);
         return((top.HasValue ? i.Take(top.Value) : i).ToList());
     }
 }
示例#2
0
文件: Db.cs 项目: kvchernyaev/Pochta
        public int InsertIncomingRequest(string str, string clientAddress)
        {
            using (var db = new PochtaDbContext())
            {
                IncomingRequest rInserted = db.IncomingRequests.Add(new IncomingRequest {
                    ClientAddress = clientAddress, Str = str, IncomedDate = DateTime.Now
                });
                db.SaveChanges();

                return(rInserted.Id);
            }
        }