コード例 #1
0
        public IHttpActionResult PostParticipant([FromUri] string groupName, [FromBody] AddParticipantViewModel userModel)
        {
            if (string.IsNullOrEmpty(groupName) || !ModelState.IsValid)
            {
                return(BadRequest());
            }

            var user = this._usersService.GetUserByUsername(userModel.Username);

            if (user == null)
            {
                return(NotFound());
            }

            var hasRequest = this._requestsService.AlreadyHasRequest(user.Id, groupName);

            if (!hasRequest)
            {
                return(Content(HttpStatusCode.Forbidden, "You do not have request for this group."));
            }

            this._groupsService.AddUserToGroup(groupName, user);

            return(Content(HttpStatusCode.Created, "The user was added!"));
        }
コード例 #2
0
        private void AddParticipant()
        {
            AddParticipantViewModel dialogViewModel = new AddParticipantViewModel();

            dialogViewModel.ShowDialog("Add participant");
        }