Example #1
0
        public void Save(Model.EDEntities db)
        {
            var result = (from p in db.Certificates
                         where p.SerialNumber == this.SerialNumber
                         select p).Count();

            if (result > 0)
                throw new ApplicationException("Person with this certificate has already been registered");

            var certificate = this.Map();
            db.Certificates.Add(certificate);
            db.SaveChanges();
            this.ID = certificate.ID;
        }
Example #2
0
        public void Save(Model.EDEntities db)
        {
            var result = (from p in db.People
                          where p.Login.ToUpper() == this.Login.ToUpper()
                          select p).Count();

            if (result > 0)
                throw new ApplicationException("Person with this login has already been registered");

            var person = this.Map();
            db.People.Add(person);
            db.SaveChanges();
            this.ID = person.ID;
        }