public ActionResult AddCollection(MainCollection collection) { if (collection != null) { repository.SaveCollection(collection); repository.SaveChanges(); } return(RedirectToAction("Index")); }
public ActionResult AddCollection(MainCollection collection) { if (collection != null) { db.MainCollections.Add(collection); db.SaveChanges(); } return(RedirectToAction("Index")); }
private void LoadAsync() { if (MainCollection.Count > 0) { var data = MainCollection.Last(); KonpensasiTerlambat = data.KonpensasiTerlambat; Id = data.Id; JamMasuk = data.JamMasuk; JamPulang = data.JamPulang; } RingProgressActive = false; }
static void Main(string[] args) { MainCollection<int, string, DateTime> collection = new MainCollection<int, string, DateTime>(); collection.Add(Tuple<int, string>.Create(1, "Bob"), new DateTime(1992, 12, 1)); collection.Add(Tuple<int, string>.Create(2, "James"), new DateTime(1945, 9, 1)); collection.Add(Tuple<int, string>.Create(3, "Julie"), new DateTime(1976, 7, 15)); DateTime date; date = collection.GetValue(1); Console.WriteLine("Bob birthdate: {0}", date); date = collection.GetValue("Julie"); Console.WriteLine("#3 birthdate: {0}", date); Console.ReadLine(); }
public async Task <ActionResult> Resource(string id, string ResourceName, int?page) { int pageSize = 4; int pageNumber = (page ?? 1); if (currencResource.ResourceName == ResourceName) { ViewBag.URL = currencResource.URL; ViewBag.RSSName = ResourceName; ViewBag.CollectionName = id; return(View(RSSFeedData.ToPagedList(pageNumber, pageSize))); } // find collection by name (made for user-friendly url despite the speed) currentCollection = await repository.FindCollectionByNameAsync(ViewBag.CollectionName); // find resource currencResource = await repository.FindResourceByNameAsync(ResourceName); WebClient wclient = new WebClient(); string RSSData = wclient.DownloadString(currencResource.URL); XDocument xml = XDocument.Parse(RSSData); RSSFeedData = (from x in xml.Descendants("item") let bytesTitle = Encoding.Default.GetBytes(((string)x.Element("title"))) let bytesDesc = Encoding.Default.GetBytes(((string)x.Element("description"))) select new RSSFeed { Title = Encoding.UTF8.GetString(bytesTitle), Link = ((string)x.Element("link")), Description = Encoding.UTF8.GetString(bytesDesc), PubDate = ((string)x.Element("pubDate")) }); ViewBag.URL = currencResource.URL; ViewBag.RSSName = ResourceName; ViewBag.CollectionName = ViewBag.CollectionName; return(View(RSSFeedData.ToPagedList(pageNumber, pageSize))); }
private void DeleteCommandAction(object obj) { MainCollection.Remove(SelectedItem); MainCollection.SourceView.Refresh(); }
private void SaveAction(object obj) { MainCollection.Add(new pengaturan { JamMasuk = JamMasuk, JamPulang = JamPulang, KonpensasiTerlambat = KonpensasiTerlambat }); }