示例#1
0
        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));
        }
示例#2
0
 public void Update(Participant participant)
 {
     this.participants.Update(participant);
 }
示例#3
0
 public void Remove(Participant participant)
 {
     this.participants.Delete(participant);
 }
示例#4
0
 public void Add(Participant participant)
 {
     this.participants.Add(participant);
 }