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