示例#1
0
 /// <summary>
 /// Inserts AssociateAddress into the database
 /// </summary>
 /// <param name="assad"></param>
 /// <returns></returns>
 public bool InsertAssociateAddress(AssociateAddress assad)
 {
     assad.Active = true;
     try
     {
         db.AssociateAddress.Add(assad);
         int columnsAffected = db.SaveChanges();
         if (columnsAffected == 0)
         {
             return(false);
         }
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
示例#2
0
 /// <summary>
 /// Will deletes AssociateAddress by setting Active Bit
 /// </summary>
 /// <param name="assodr"></param>
 /// <returns></returns>
 public bool DeleteAssociateAddress(AssociateAddress assodr)
 {
     try
     {
         var oldasso = db.AssociateAddress.FirstOrDefault(a => a.AssociateID == assodr.AssociateAddressID);
         if (oldasso != null)
         {
             assodr        = oldasso;
             assodr.Active = false;
             db.Entry(oldasso).CurrentValues.SetValues(assodr);
             db.SaveChanges();
         }
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
示例#3
0
 /// <summary>
 /// Will update the AssociateAddress in the database
 /// </summary>
 /// <param name="assodr"></param>
 /// <returns></returns>
 public bool UpdateAssociateAddress(AssociateAddress assodr)
 {
     try
     {
         var oldasso = db.AssociateAddress.FirstOrDefault(a => a.AssociateID == assodr.AssociateAddressID);
         if (oldasso != null)
         {
             db.Entry(oldasso).CurrentValues.SetValues(assodr);
             int columnsAffected = db.SaveChanges();
             if (columnsAffected == 0)
             {
                 return(false);
             }
         }
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }