コード例 #1
0
 public ActionResult Consulta(int id)
 {
     using (var facade = FacadeFactory.Item())
     {
         var response = facade.Retrieve(id);
         return(PartialView("_Consulta", response));
     }
 }
コード例 #2
0
        public ActionResult About()
        {
            using (var facade = FacadeFactory.Item())
            {
                var response = facade.RetrieveCollection(new ItemCondition {
                    Completed = false, UserId = 1
                });
                return(View(response));
            }



            ViewBag.Message = "Your application description page.";

            return(View());
        }
コード例 #3
0
        public ActionResult Index()
        {
            using (WebClient webclient = new WebClient())
                using (var facade = FacadeFactory.Item())
                {
                    if (Global.IsDatabaseCreated && !Global.IsSeeked)
                    {
                        var    json  = webclient.DownloadString("https://jsonplaceholder.typicode.com/todos");
                        Item[] itens = JsonConvert.DeserializeObject <Item[]>(json);


                        var response = facade.CreateCollection(itens);
                        if (response.Success)
                        {
                            var responsecollection = facade.RetrieveCollection(new ModelCondition <Item>());
                            return(View(responsecollection));
                        }
                    }

                    var responsecollect = facade.RetrieveCollection(new ModelCondition <Item>());
                    return(View(responsecollect));
                }
        }