Example #1
0
        public HttpResponseMessage GetBoardMembersByProperty(int propertyId)
        {
            var repository = new BoardMembersRepository();
            var result     = repository.ListAllBoardMembers().Where(bm => bm.PropertyId == propertyId);

            return(Request.CreateResponse(HttpStatusCode.OK, result));
        }
Example #2
0
        public HttpResponseMessage GetSingleBoardMember(int id)
        {
            var repository = new BoardMembersRepository();
            var result     = repository.GetBoardMemberById(id);

            return(Request.CreateResponse(HttpStatusCode.OK, result));
        }
Example #3
0
        public HttpResponseMessage GetBoardMembersList()
        {
            var repository = new BoardMembersRepository();
            var result     = repository.ListAllBoardMembers();

            return(Request.CreateResponse(HttpStatusCode.OK, result));
        }
Example #4
0
        public HttpResponseMessage DeleteBoardMember(int id)
        {
            var repository = new BoardMembersRepository();
            var result     = repository.Delete(id);

            if (result)
            {
                return(Request.CreateResponse(HttpStatusCode.OK));
            }
            return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Could not find board member"));
        }
Example #5
0
        public HttpResponseMessage AddNewBoardMember(BoardMembersDto boardmember)
        {
            var repository = new BoardMembersRepository();
            var result     = repository.Create(boardmember);

            if (result)
            {
                return(Request.CreateResponse(HttpStatusCode.Created));
            }
            return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Board Member could not be added"));
        }
 public BoardMembersService(BoardMembersRepository repo)
 {
     _repo = repo;
 }