private void addNewRewardToolStripMenuItem_Click(object sender, EventArgs e) { string result = Interaction.InputBox("Insert IDs of rewards\nFormat:\n1,2,3..", "Rewards"); if (!String.IsNullOrEmpty(result)) { var rewardIDs = Regex.Matches(result, @"\d+").Cast <Match>().Select(x => Int32.Parse(x.Value)).ToList(); _memory.AddRewardToUser(_id, rewardIDs); UserRewards_dataGridView.DataSource = _memory.GetUserRewardsByID(_id); } }
public ActionResult Edit(User user, List <int> rewards, List <int> removeRewards) { if (rewards != null) { data.AddRewardToUser(user.ID, rewards); } if (removeRewards != null) { foreach (var i in removeRewards) { data.DeleteRewardFromUser(user.ID, i); } } data.UpdateUser(user); return(View("Index", data.GetUsers())); }