public ActionResult CreateGroup(Group groupToCreate) { if (ModelState.IsValid) { webcsmRepository.AddUserToGroup(groupToCreate, User.Identity.Name); webcsmRepository.CreateGroup(groupToCreate); webcsmRepository.Save(); return RedirectToAction("Index"); } return View(groupToCreate); }
public Group CreateGroup(Group groupToCreate) { db.AddToGroups(groupToCreate); return groupToCreate; }
public Group AddUserToGroup(Group group, string userName) { group.UserId = (int)Membership.GetUser(userName).ProviderUserKey; return group; }
/// <summary> /// Create a new Group object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="userId">Initial value of the UserId property.</param> public static Group CreateGroup(global::System.Int32 id, global::System.String name, global::System.Int32 userId) { Group group = new Group(); group.Id = id; group.Name = name; group.UserId = userId; return group; }
/// <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); }