Click here to Skip to main content
15,886,919 members
Home / Discussions / C#
   

C#

 
GeneralRe: Need to understand work assigned to me Pin
jschell14-Dec-17 8:51
jschell14-Dec-17 8:51 
GeneralRe: Need to understand work assigned to me Pin
Richard MacCutchan14-Dec-17 9:27
mveRichard MacCutchan14-Dec-17 9:27 
GeneralRe: Need to understand work assigned to me Pin
nisss14-Dec-17 20:39
nisss14-Dec-17 20:39 
GeneralRe: Need to understand work assigned to me Pin
nisss14-Dec-17 20:40
nisss14-Dec-17 20:40 
AnswerRe: Need to understand work assigned to me Pin
Gerry Schmitz14-Dec-17 5:26
mveGerry Schmitz14-Dec-17 5:26 
GeneralRe: Need to understand work assigned to me Pin
nisss14-Dec-17 20:33
nisss14-Dec-17 20:33 
GeneralRe: Need to understand work assigned to me Pin
Gerry Schmitz14-Dec-17 22:48
mveGerry Schmitz14-Dec-17 22:48 
QuestionHTTP GET Pin
Member 1355170113-Dec-17 2:54
Member 1355170113-Dec-17 2:54 
Hope someone can share some knowledge.

I made a HttpPost method, which sent a list of ids to a method in my service. The method then compared the ids to a anothers list, and return the object, which does´t contain the ids from the post request.

Now I want to make a HTTP Get method, which get the object after they are sorted

C#
<pre> public List<ProductBO> GetAll()
        {
            using (var uow = facade.UnitOfWork)
            {
                return uow.ProductRepository.GetAll().Select(p => Pconv.Convert(p)).ToList();
            }
        }
        public List<ProductBO> FilteretProduct(List<int> ids)
        {
            // Get all the product from the repository
            var AllProducts = GetAll();
            List<ProductBO> FilteredProducts = new List<ProductBO>();
            // Runs through the list of all the products of var AllProducts
            foreach (var prod in AllProducts)
            {
                //Runs through list ids that we get from the controller post request
                foreach (var id in ids)
                {
                    /*If: the IngredientIds(list of ids) of the current
                     * product doesn't contain the current id
                     * Then add that product to the 'FilteredProducts' List*/
                    if (!prod.IngredientIds.Contains(id))
                    {
                        FilteredProducts.Add(prod);
                    }
                }
            }
            //returning the list
            return FilteredProducts;
        }


<pre>
        // This post request, gets the ids, which are used in the FilteretProduct method.
        [HttpPost]
        [Route("FilteredProducts")]
        public List<ProductBO> FilteredList(List<int> ids)
        {
            List<ProductBO>filterProduct;
            return filterProduct = facade.ProductService.FilteretProduct(ids);


        }
        [HttpGet]
        [Route("GetFilteredProducts")]
        public List<ProductBO> GetFilteredList()
        {
            //The list from  above
            return filterProduct;


        }


AnswerRe: HTTP GET Pin
Richard Deeming13-Dec-17 3:06
mveRichard Deeming13-Dec-17 3:06 
GeneralRe: HTTP GET Pin
Member 1355170113-Dec-17 7:25
Member 1355170113-Dec-17 7:25 
QuestionC# interface Pin
Member 1212070811-Dec-17 1:23
Member 1212070811-Dec-17 1:23 
AnswerRe: C# interface Pin
Pete O'Hanlon11-Dec-17 1:27
mvePete O'Hanlon11-Dec-17 1:27 
QuestionVoting System in C# Pin
Member 1356906610-Dec-17 20:41
Member 1356906610-Dec-17 20:41 
AnswerRe: Voting System in C# Pin
Richard MacCutchan10-Dec-17 20:59
mveRichard MacCutchan10-Dec-17 20:59 
GeneralRe: Voting System in C# Pin
Member 1356906610-Dec-17 22:16
Member 1356906610-Dec-17 22:16 
GeneralRe: Voting System in C# Pin
Richard MacCutchan10-Dec-17 22:38
mveRichard MacCutchan10-Dec-17 22:38 
GeneralRe: Voting System in C# Pin
Pete O'Hanlon10-Dec-17 22:47
mvePete O'Hanlon10-Dec-17 22:47 
AnswerRe: Voting System in C# Pin
OriginalGriff10-Dec-17 23:32
mveOriginalGriff10-Dec-17 23:32 
GeneralRe: Voting System in C# Pin
Mycroft Holmes10-Dec-17 23:39
professionalMycroft Holmes10-Dec-17 23:39 
GeneralRe: Voting System in C# Pin
OriginalGriff10-Dec-17 23:43
mveOriginalGriff10-Dec-17 23:43 
GeneralRe: Voting System in C# Pin
phil.o11-Dec-17 18:02
professionalphil.o11-Dec-17 18:02 
QuestionGeneric type passed into method question Pin
User987439-Dec-17 20:44
professionalUser987439-Dec-17 20:44 
AnswerRe: Generic type passed into method question Pin
OriginalGriff9-Dec-17 22:32
mveOriginalGriff9-Dec-17 22:32 
QuestionRe: Generic type passed into method question Pin
User9874310-Dec-17 0:49
professionalUser9874310-Dec-17 0:49 
AnswerRe: Generic type passed into method question Pin
OriginalGriff10-Dec-17 0:57
mveOriginalGriff10-Dec-17 0:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.