Exemplo n.º 1
0
        public static void edit(Registrations newRegistration, uint origId)
        {
            var orig = get(origId);

            using (var dbContext = new WashingtonRedskinsContext())
            {
                dbContext.Entry(orig).CurrentValues.SetValues(newRegistration);
                dbContext.Entry(orig).State = EntityState.Modified;
                dbContext.SaveChanges();
            }
            var earliestTime = newRegistration.Time < orig.Time ? newRegistration.Time : orig.Time;

            RegistrationsEdits.set(earliestTime);
        }
Exemplo n.º 2
0
        public static void add(uint userId, uint statusId)
        {
            Registrations reg = new Registrations();

            Users usr;

            using (var dbContext = new WashingtonRedskinsContext())
            {
                usr = dbContext.Users.Find(userId);
            }

            reg.UserId       = userId;
            reg.Time         = DateTime.Now;
            reg.DepartmentId = usr.DepartmentId;
            reg.StatusId     = statusId;

            using (var dbContext = new WashingtonRedskinsContext())
            {
                dbContext.Add(reg);
                dbContext.SaveChanges();
            }
        }