コード例 #1
0
 public HttpResponseMessage DnnHelloPersonalize(DetailsDTO data)
 {
     try
     {
         string dnnMessage = "Hello " + data.name + " from DNN!";
         return(Request.CreateResponse(HttpStatusCode.OK, dnnMessage));
     }
     catch (System.Exception ex)
     {
         //Log exception and reply with Error
         Exceptions.LogException(ex);
         return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message));
     }
 }
コード例 #2
0
 public HttpResponseMessage DnnGoodbye(DetailsDTO data)
 {
     try
     {
         string dnnMessage = "Hello from Dnn!";
         if (data.goodbye)
         {
             dnnMessage = "Goodbye from Dnn!";
         }
         return(Request.CreateResponse(HttpStatusCode.OK, dnnMessage));
     }
     catch (System.Exception ex)
     {
         //Log exception and reply with Error
         Exceptions.LogException(ex);
         return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message));
     }
 }
コード例 #3
0
        public int DetailCreate(DetailsDTO detailsDTO)
        {
            var createDetail = details.Create(mapper.Map <Details>(detailsDTO));

            return((int)createDetail.Id);
        }
コード例 #4
0
        public void DetailsUpdate(DetailsDTO detailsDTO)
        {
            var updateDetail = details.GetAll().SingleOrDefault(c => c.Id == detailsDTO.Id);

            details.Update((mapper.Map <DetailsDTO, Details>(detailsDTO, updateDetail)));
        }
コード例 #5
0
        public async Task OnGetAsync()
        {
            string aux1  = "";
            var    posts = await pcc.getAllDetailsAsync();

            int        ok = 1;
            DetailsDTO pd = new DetailsDTO();

            aparitii = posts.Count / 5;
            foreach (var item in posts)
            {
                //Console.WriteLine(item);
                if (ok == 1)
                {
                    string   aux   = item.Replace('\\', '/');
                    string[] words = aux.Split('/');
                    pd.Path = '/' + words[8] + '/' + words[9];
                }
                else if (ok == 2)
                {
                    pd.Locatie = item;
                }
                else if (ok == 3)
                {
                    pd.Anotimp = item;
                }
                else if (ok == 4)
                {
                    pd.Data = item;
                }
                else if (ok == 5)
                {
                    if (aux1 == "")
                    {
                        pd.People = item;
                        Details.Add(pd);
                        ok   = 0;
                        aux1 = item;
                    }
                    else
                    {
                        int    k1    = aux1.Length;
                        string after = item.Remove(0, k1);
                        pd.People = after;
                        Details.Add(pd);
                        ok   = 0;
                        aux1 = item;
                    }
                    pd = new DetailsDTO();
                }
                ok++;
            }


            if (!string.IsNullOrEmpty(SearchString))
            {
                Details.Clear();
                ok = 1;
                pd = new DetailsDTO();
                var search_result = await pcc.getPathsAsync(SearchString);

                aparitii = search_result.Count;
                //Console.WriteLine(search_result.Count);
                foreach (var item in search_result)
                {
                    var details = await pcc.getDetailsAsync(item);

                    foreach (var item2 in details)
                    {
                        if (ok == 1)
                        {
                            string   aux   = item.Replace('\\', '/');
                            string[] words = aux.Split('/');
                            pd.Path = '/' + words[8] + '/' + words[9];
                        }
                        else if (ok == 2)
                        {
                            pd.Locatie = item2;
                        }
                        else if (ok == 3)
                        {
                            pd.Anotimp = item2;
                        }
                        else if (ok == 4)
                        {
                            pd.Data = item2;
                        }
                        else if (ok == 5)
                        {
                            pd.People = item2;
                            Details.Add(pd);
                            ok = 0;
                            pd = new DetailsDTO();
                        }
                        ok++;
                    }
                }
            }
        }