public RestAPIGetUserIdeaResponse GetPublicList([FromUri] int CategoryId = 0, [FromUri] bool Sort = false) { RestAPIGetUserIdeaResponse response = new RestAPIGetUserIdeaResponse(); submitIdeaUtil.GetPublicIdeas(response, UserID, CategoryId, Sort); return(response); }
public RestAPIGetUserIdeaResponse GetIdeaList([FromUri] bool IsDraft = false) { RestAPIGetUserIdeaResponse response = new RestAPIGetUserIdeaResponse(); submitIdeaUtil.GetIdeas(response, UserID, IsDraft); return(response); }
public void GetIdeaListTest() { RestAPIGetUserIdeaResponse response = new RestAPIGetUserIdeaResponse(); List <Idea> ideaList = new List <Idea>(); int UserId = 1; bool IsDraft = false; queryUtilMock.Setup(x => x.GetIdeas(It.IsAny <IIdeaDatabaseDataContext>(), It.IsAny <int>())).Returns(ideaList); submitIdeaMock.Setup(x => x.GetIdeas(It.IsAny <RestAPIGetUserIdeaResponse>(), It.IsAny <int>(), It.IsAny <bool>())); submitIdeaUtil.GetIdeas(response, UserId, IsDraft); Assert.IsTrue(response.ErrorList.Count == 0); }
public void GetIdeas(RestAPIGetUserIdeaResponse response, int UserId, bool IsDraft = false) { List <RESTAPIIdeaInterchange> ideaInterchangeList = null; List <Idea> ideaList = null; DatabaseWrapper.databaseOperation(response, (context, query) => { ideaInterchangeList = new List <RESTAPIIdeaInterchange>(); ideaList = new List <Idea>(); if (IsDraft) { ideaList = query.GetDraftIdeas(context, UserId); } else { ideaList = query.GetIdeas(context, UserId); } if (ideaList.Count > 0) { foreach (var idea in ideaList) { RESTAPIIdeaInterchange ideaInterchange = new RESTAPIIdeaInterchange(idea); ideaInterchangeList.Add(ideaInterchange); } } response.Status = Success; } , readOnly: true ); if (ideaInterchangeList != null && ideaInterchangeList.Count > 0) { response.IdeaList.AddRange(ideaInterchangeList); } }