public List <hub> courseFetch(int amount) { List <hub> list = new List <hub>(); for (int i = 0; i < amount; i++) { hub hubber = new hub { courseId = Guid.NewGuid(), name = "Course's name " + i, creator = Guid.NewGuid(), company = Guid.NewGuid(), created = DateTime.Now.Date.ToString() + '.' + DateTime.Now.Month.ToString() + '.' + DateTime.Now.Year.ToString(), img = new image { type = 0, path = "", name = "imageName" }, information = "", price = new price { amount = 120, currency = "EUR" }, duration = new duration { amount = 12, unit = 0 } }; list.Add(hubber); } return(list); }
public ActionResult Create(hub hub) { if (ModelState.IsValid) { db.hubs.Add(hub); db.SaveChanges(); return(RedirectToAction("Index")); } return(View()); }
public ActionResult Edit(hub hub) { if (ModelState.IsValid) { var entry = db.Entry(hub); entry.State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(hub)); }