public async Task<ActionResult> Add(UserSelectedViewModel model) { var getSelectedUsers = model.GetSelectedUsers(); if (getSelectedUsers.Count == 0) { this.ModelState.AddModelError(string.Empty, "Трябва да изберете най-малко един учасник."); return this.View(model); } foreach (var participant in getSelectedUsers) { var currentParticipant = new Participant() { RateSystemId = model.RateSystemId, UserId = participant.Id }; this.participants.Add(currentParticipant); } this.participants.SaveChanges(); this.AddNotification("Успешно добавихте учасници!", NotificationType.SUCCESS); return this.RedirectToAction<UserController>(c => c.Add(model.RateSystemId)); }
public void Update(Participant participant) { this.participants.Update(participant); }
public void Remove(Participant participant) { this.participants.Delete(participant); }
public void Add(Participant participant) { this.participants.Add(participant); }