// GET: Appointment public ActionResult Index(string id) { CalendarModel = new CalendarModel(new Storage()); CalendarModel.logUser(stateManager.load("login")); if (stateManager.load("Error") != null) { ViewBag.Error = true; ViewBag.msg = stateManager.load("Error") + " - " + "page refreshed."; stateManager.save("Error", null); } if (id != null && id != "new") { MyAppointment = CalendarModel.GetAppointment(id); } else { MyAppointment = new Appointment { AppointmentID = Guid.Empty, Title = "", Description = "", AppointmentDate = DateTime.Now, StartTime = TimeSpan.Parse("10:00"), EndTime = TimeSpan.Parse("12:00"), timestamp = new byte[1] }; } return(View(MyAppointment)); }