private void CreateFixture(string email, bool present, out Event @event, out User user, out Booking book)
            {
                user   = Context.User.Include(e => e.Role).FirstOrDefault(u => u.Email == email);
                @event = Context.Event.Find(1);

                @event.OpenAt  = DateTime.Now.AddDays(-1);
                @event.CloseAt = DateTime.Now.AddDays(1);
                @event.Status  = Status.ONGOING;
                book           = new Booking()
                {
                    UserId = user.Id, EventId = @event.Id, Present = present
                };

                // Add Fake JuryPoints
                if (present)
                {
                    @event.JuryPoint = 1345.13F;
                    JuryPoint jp = new JuryPoint()
                    {
                        Points = (float)@event.JuryPoint, UserId = user.Id
                    };
                    Context.JuryPoints.Add(jp);
                }
                JuryPoint jp2 = new JuryPoint()
                {
                    Points = 1345.14F, UserId = user.Id
                };

                Context.JuryPoints.Add(jp2);
                Context.Booking.Add(book);
                Context.Event.Update(@event);
                Context.SaveChanges();
            }
Esempio n. 2
0
        public JuryPoint CreateJuryPoint(float points, int userId)
        {
            JuryPoint juryPoint = new JuryPoint {
                Points = points,
                UserId = userId
            };

            Context.JuryPoints.Add(juryPoint);
            return(juryPoint);
        }
Esempio n. 3
0
 public void RemoveJuryPoints(JuryPoint juryPoint)
 {
     Context.Remove(juryPoint);
 }