public User_ConferenceDTO addUserConference(User_ConferenceDTO userConference) { using (var uow = new UnitOfWork()) { var userConfereceRepo = uow.getRepository <User_Conference>(); var newUserConference = userConfereceRepo.save(converter.convertToPOCOModel(userConference)); uow.saveChanges(); userConference.Id = newUserConference.Id; return(userConference); } }
public User_Conference convertToPOCOModel(User_ConferenceDTO model) { User_Conference poco = new User_Conference(); poco.Id = model.Id; poco.ConferenceId = model.ConferenceId; poco.UserId = model.UserId; poco.Role = (UserRole)Enum.Parse(typeof(UserRole), model.Role, true); return(poco); }
private void AddReviewerButton_Click(object sender, EventArgs e) { var users = _clientController .getAllValidatedUsers() .Where(user => user.Id != _user.Id) .ToList(); var exist = false; var userId = 0; foreach (var user in users) { if (user.Username.Equals(UsernameTextBox.Text)) { exist = true; userId = user.Id; } } if (exist) { var userss = _clientController .getPCMembersForConference(_conference.Id) .Where(u => u.Id == userId) .ToList(); if (userss.Count == 0) { var userConference = new User_ConferenceDTO { UserId = userId, ConferenceId = _conference.Id, Role = UserRole.Reviewer.ToString() }; _clientController.addReviewer(userConference); MessageBox.Show("The reviewer was added successfully"); this.Close(); } else { MessageBox.Show("This user already has a role!"); } } else { MessageBox.Show("Please insert a valid username!"); } }
public User_ConferenceDTO buyTicket(int idU, int idC) { using (var uow = new UnitOfWork()) { var repo = uow.getRepository <User_Conference>(); repo.save(new User_Conference { UserId = idU, ConferenceId = idC }); uow.saveChanges(); var item = repo.getAll().Where(x => x.ConferenceId == idC && x.UserId == idU); User_Conference existingItem = item.ElementAt(0); User_ConferenceDTO newitem = new User_ConferenceDTO(); newitem.Id = existingItem.Id; newitem.Role = existingItem.Role.ToString(); newitem.UserId = existingItem.UserId; newitem.ConferenceId = existingItem.ConferenceId; return(newitem); } }
public User_ConferenceDTO addUserConference(User_ConferenceDTO userConference) { return(_userConferenceService.addUserConference(userConference)); }
public User_ConferenceDTO addReviewer(User_ConferenceDTO coChair) { return(_server.addUserConference(coChair)); }