public int Update(Group obj) { var Grp = cont.Groups.Single(e => e.GId == obj.GId); if (Grp != null) { Grp.GName = obj.GName; return cont.SaveChanges(); } return 0; }
public int Create(Group obj) { var Grp= cont.Groups.Single(e => e.GName == obj.GName); if (Grp != null) { return Grp.GId; } cont.Groups.AddObject(obj); cont.SaveChanges(); return Grp.GId; }
/// <summary> /// Deprecated Method for adding a new object to the Groups EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToGroups(Group group) { base.AddObject("Groups", group); }
/// <summary> /// Create a new Group object. /// </summary> /// <param name="gId">Initial value of the GId property.</param> public static Group CreateGroup(global::System.Int32 gId) { Group group = new Group(); group.GId = gId; return group; }