public IHttpActionResult JoinWall(int wallId, string attendeeId = null) { if (wallId <= 0) { return(BadRequest()); } var userAndOrg = GetUserAndOrganization(); if (string.IsNullOrEmpty(attendeeId)) { attendeeId = userAndOrg.UserId; } try { var userDto = _wallService.JoinLeaveWall(wallId, attendeeId, userAndOrg.UserId, userAndOrg.OrganizationId, false); var result = _mapper.Map <ApplicationUserMinimalDto, ApplicationUserMinimalViewModel>(userDto); return(Ok(result)); } catch (ValidationException e) { return(BadRequestWithError(e)); } catch (UnauthorizedException) { return(Forbidden()); } }
public void Wall_JoinWall_Should_Return_View_Model() { var wallId = 1; var userDto = new ApplicationUserMinimalViewModelDto { Id = "Id" }; _wallService.JoinLeaveWall(wallId, null, null, 0, false).ReturnsForAnyArgs(userDto); var response = _wallController.JoinWall(wallId); Assert.IsInstanceOf <OkNegotiatedContentResult <ApplicationUserMinimalViewModel> >(response); }