示例#1
0
 static void Main(string[] args)
 {
     ListicusRestClient client = new ListicusRestClient();
     List list = new List{Name = "ClientList1"};
     client.CreateList(list);
     Console.WriteLine(XmlSerializerHelper.SerializeToString(list));
 }
示例#2
0
        public List CreateList(List list)
        {
            if (!list.Links.HasItems())
                return null;

            context.Lists.Add(list);
            context.SaveChanges();
            return list;
        }
示例#3
0
        private static void AddLinkModelToList(LinkModel linkModel, List list)
        {
            if (linkModel != null && linkModel.Url.IsValidUrl())
            {
                if (list.Links == null)
                    list.Links = new List<Link>();

                Link link = linkModel.CreateLink();

                list.Links.Add(link);
            }
        }
示例#4
0
        public static List CreateList(this ListModel model)
        {
            var list = new List {Id = model.Id.ToLongOrDefault(), Name = model.Name.ToNullOrValue()};

            if (model.Links != null)
            {
                foreach (LinkModel linkModel in model.Links)
                {
                    AddLinkModelToList(linkModel, list);
                }
            }

            return list;
        }
示例#5
0
 //        public List<List> GetAllLists()
 //        {
 //            
 //        }
 public List CreateList(List list)
 {
     var serializer = new XmlSerializer(typeof(List), "http://schemas.listicus.com");
     HttpClient client = new HttpClient();
     string listXml = XmlSerializerHelper.SerializeToString(serializer, list);
     HttpResponseMessage returnValue = client.Post(ListicusRestUrl, "text/xml", HttpContent.Create(listXml));
     if (returnValue.StatusCode == HttpStatusCode.OK)
     {
         List returnedOrder = XmlSerializerHelper.DeserializeString<List>(serializer, returnValue.Content.ReadAsString());
         return returnedOrder;
     }
     else
     {
         throw new HttpResponseError(returnValue.StatusCode, returnValue.Content.ReadAsString());
     }
 }
示例#6
0
 public ActionResult Index(List list)
 {
     ListLogic listLogic = new ListLogic();
     return new ObjectResult<List>(listLogic.CreateList(list));
 }