/// <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); } }
/// <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); } }
/// <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); } }