Exemplo n.º 1
0
        public void ModifyRecord(int id, string name, string familyName, string phoneNumber)
        {
            PB_RECORDS rec = TakeRecord(id);

            rec.PBR_NAME         = name;
            rec.PBR_PHONE_NUMBER = phoneNumber;
            rec.PBR_FAMILY_NAME  = familyName;
            ent.SaveChanges();
        }
Exemplo n.º 2
0
        public PB_RECORDS TakeRecord(int id, pbEntities ent)
        {
            PB_RECORDS rec = ent.PB_RECORDS.Where(o => o.PBR_ID == id).FirstOrDefault();

            if (rec == null)
            {
                throw new Exception(string.Format("record with id:{0} does not persist", id));
            }
            return(rec);
        }
Exemplo n.º 3
0
        public int AddRecord(string name, string familyName, string phoneNumber)
        {
            PB_RECORDS rec = ent.PB_RECORDS.Add(new PB_RECORDS
            {
                PBR_FAMILY_NAME  = familyName,
                PBR_NAME         = name,
                PBR_PHONE_NUMBER = phoneNumber
            });

            ent.SaveChanges();
            return(rec.PBR_ID);
        }