예제 #1
0
 public RequestGroup Post(RequestGroup requestGroup)
 {
     using (var db = new PtoContext()){
         var user = db.User.FirstOrDefault(x => x.id == requestGroup.userId);
         requestGroup.user = user;
         db.Add(requestGroup);
         db.SaveChanges();
         //sendNewRequestEmail(user);
     }
     return(requestGroup);
 }
예제 #2
0
 public RequestGroup Patch(RequestGroup requestGroup)
 {
     using (var db = new PtoContext()){
         var entity = db.RequestGroup.FirstOrDefault(x => x.id == requestGroup.id);
         if (entity != null)
         {
             entity.status = requestGroup.status;
             db.SaveChanges();
             //sendUpdatedRequestEmail(db.User.FirstOrDefault(x => x.id == 90650));
         }
     }
     return(requestGroup);
 }
예제 #3
0
        public PtoController(PtoContext context)
        {
            _context = context;

            if (_context.PtoItems.Count() == 0)
            {
                // Create a new PtoItem if collection is empty,
                // which means you can't delete all PtoItems.
                _context.PtoItems.Add(new PtoItem {
                    Name = "Item1"
                });
                _context.SaveChanges();
            }
        }