Пример #1
0
        public int RegisterPerson(Person person)
        {
            var p = new OCC.Data.Person();
            Mapper.CopyProperties(person, p);

            _dbContext.People.Add(p);
            _dbContext.SaveChanges();

            return p.ID;
        }
Пример #2
0
        public int RegisterPerson(Person person)
        {
            var p = new OCC.Data.Person();

            Mapper.CopyProperties(person, p);

            _dbContext.People.Add(p);
            _dbContext.SaveChanges();

            return(p.ID);
        }
Пример #3
0
        public Person FindPersonByEmail(string email)
        {
            Person dcAttendee = default(Person);

            var bcAttendee = _dbContext.People.Where(p => p.Email == email)
                .SingleOrDefault();

            if (bcAttendee != null)
            {
                dcAttendee = new Person();
                Mapper.CopyProperties(bcAttendee, dcAttendee);
            }
            return dcAttendee;
        }
Пример #4
0
        public Person FindPersonByEmail(string email)
        {
            Person dcAttendee = default(Person);

            var bcAttendee = _dbContext.People.Where(p => p.Email == email)
                             .SingleOrDefault();

            if (bcAttendee != null)
            {
                dcAttendee = new Person();
                Mapper.CopyProperties(bcAttendee, dcAttendee);
            }
            return(dcAttendee);
        }
Пример #5
0
        public void UpdatePerson(Person person)
        {
            var p = _dbContext.People.Find(person.ID);

            p.FirstName  = person.FirstName;
            p.LastName   = person.LastName;
            p.Title      = person.Title;
            p.Bio        = person.Bio;
            p.Website    = person.Website;
            p.Blog       = person.Blog;
            p.Twitter    = person.Twitter;
            p.ImageUrl   = person.ImageUrl;
            p.Location   = person.Location;
            p.TShirtSize = person.TShirtSize;

            _dbContext.SaveChanges();
        }
Пример #6
0
        public Person Login(Person person)
        {
            Person dcAttendee = default(Person);

            var bcAttendee =
                _dbContext.People
                    .SingleOrDefault(p =>
                        p.Email == person.Email &&
                        p.PasswordHash == person.PasswordHash);

            if (bcAttendee != null)
            {
                dcAttendee = new Person();
                Mapper.CopyProperties(bcAttendee, dcAttendee);
            }

            return dcAttendee;
        }
Пример #7
0
        public Person Login(Person person)
        {
            Person dcAttendee = default(Person);

            var bcAttendee =
                _dbContext.People
                .SingleOrDefault(p =>
                                 p.Email == person.Email &&
                                 p.PasswordHash == person.PasswordHash);

            if (bcAttendee != null)
            {
                dcAttendee = new Person();
                Mapper.CopyProperties(bcAttendee, dcAttendee);
            }

            return(dcAttendee);
        }
Пример #8
0
        public void AssignVolunteerTaskToPerson(Task task, Person person)
        {
            var e = _dbContext.Tasks.Find(task.Id);

                if (e == null)
                {
                    throw new ArgumentException("Task not found");
                }

                //OCC.Data.Task bcTask = e.Map();

                //task.Volunteers.Add()

                //List<Track> result = new List<Track>();
                //foreach (var track in e.Tracks)
                //    result.Add(track.Map());

                //result
        }
Пример #9
0
        public void AssignVolunteerTaskToPerson(Task task, Person person)
        {
            var e = _dbContext.Tasks.Find(task.Id);

            if (e == null)
            {
                throw new ArgumentException("Task not found");
            }

            //OCC.Data.Task bcTask = e.Map();

            //task.Volunteers.Add()

            //List<Track> result = new List<Track>();
            //foreach (var track in e.Tracks)
            //    result.Add(track.Map());

            //result
        }
Пример #10
0
        public static Person Map(this Data.Person p)
        {
            Person person = new Person
            {
                ID = p.ID,
                Email = p.Email,
                FirstName = p.FirstName,
                LastName = p.LastName,
                Title = p.Title,
                Bio = p.Bio,
                Website = p.Website,
                Blog = p.Blog,
                Twitter = p.Twitter,
                ImageUrl = p.ImageUrl
            };

            return person;
        }
Пример #11
0
        public void UpdatePerson(Person person)
        {
            var p = _dbContext.People.Find(person.ID);

            p.FirstName = person.FirstName;
            p.LastName = person.LastName;
            p.Title = person.Title;
            p.Bio = person.Bio;
            p.Website = person.Website;
            p.Blog = person.Blog;
            p.Twitter = person.Twitter;
            p.ImageUrl = person.ImageUrl;
            p.Location = person.Location;
            p.TShirtSize = person.TShirtSize;

            _dbContext.SaveChanges();
        }