public string Add(string title) { UserGroup ug = new UserGroup(); ug.Title = title; UserGroupService ugs = new UserGroupService(); ugs.Add(ug); List<UserGroup> list = ugs.FindAll(); UserGroupViewModel ugv = new UserGroupViewModel(list[list.Count-1]); string result = JsonConvert.SerializeObject(ugv); return result; }
/// <summary> /// Add /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAdd_Click(object sender, EventArgs e) { if ((UserId != 0) && (GroupId != 0)) { //TODO:ADD VILIDATION FOR BOTH USEERID AND GROUPID EXISTED var UserGroup = new UserGroup(); UserGroup.UserId = UserId; UserGroup.GroupId = GroupId; _userGroupService.Add(UserGroup); } BindData(); ResetUIInputtdData(); }