Exemple #1
0
        public async Task <Connection> AcceptConnection(Connection connection)
        {
            connection.Status    = Status.Accepted;
            connection.StartDate = DateTime.Now;
            _context.Entry(connection.User1).State = System.Data.Entity.EntityState.Unchanged;
            _context.Entry(connection.User2).State = System.Data.Entity.EntityState.Unchanged;
            _context.Entry(connection).State       = System.Data.Entity.EntityState.Modified;
            var result = await _context.SaveChangesAsync();

            return(connection);
        }
        public async Task <Event> CreateEvent(Event eventModel)
        {
            _context.Entry(eventModel.User).State = System.Data.Entity.EntityState.Unchanged;
            _context.Entry(eventModel).State      = System.Data.Entity.EntityState.Added;
            var result = await _context.SaveChangesAsync();

            return(eventModel);
        }