/// <summary> /// Deprecated Method for adding a new object to the condominios_moradores EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddTocondominios_moradores(condominios_moradores condominios_moradores) { base.AddObject("condominios_moradores", condominios_moradores); }
public bool Salvacondominios(List<condominio> condominios, int moradorid) { try { conservadoraEntities model = Conexao.getInstance(); IQueryable<condominios_moradores> query = from p in model.condominios_moradores where p.moradore.idmoradores == moradorid select p; foreach (condominios_moradores c in query.ToArray()) model.DeleteObject(c); model.SaveChanges(); foreach (condominio c in condominios.ToArray()) { condominios_moradores condo = new condominios_moradores(); condo.idcondominios = c.idcondominios; condo.idmoradores = moradorid; model.AddTocondominios_moradores(condo); model.SaveChanges(); } return true; } catch (Exception e) { return false; } }
/// <summary> /// Create a new condominios_moradores object. /// </summary> /// <param name="idcondominios">Initial value of the idcondominios property.</param> /// <param name="idmoradores">Initial value of the idmoradores property.</param> public static condominios_moradores Createcondominios_moradores(global::System.Int32 idcondominios, global::System.Int32 idmoradores) { condominios_moradores condominios_moradores = new condominios_moradores(); condominios_moradores.idcondominios = idcondominios; condominios_moradores.idmoradores = idmoradores; return condominios_moradores; }