public ActionResult ModifyEvents() { if (Session["UserId"] == null || (int)Session["UserId"] == 0) { ViewData["ErrorMessage"] = "You must be signed in to view this data"; return Redirect("~/Account/Login"); } ModifyEventViewModel model = new ModifyEventViewModel(); model.GetEventsCreatedBy((int)Session["UserId"]); return View("ModifyEvents", model); }
public ActionResult ModifyEvents(EventModel model, string StartTime, string EndTime, DateTime NewDate) { ModifyEventViewModel model2 = new ModifyEventViewModel(); int startMin; int startHour; int endMin; int endHour; string[] split = StartTime.Split(new char[] { ':', ' ' }); startMin = Int32.Parse(split[1]); if (split[2].Equals("PM") & !split[2].Equals("12")) { startHour = Int32.Parse(split[0]) + 12; } else if (split[2].Equals("AM") && split[2].Equals("12")) { startHour = 24; } else { startHour = Int32.Parse(split[0]); } string[] split2 = EndTime.Split(new char[] { ':', ' ' }); endMin = Int32.Parse(split2[1]); if (split2[2].Equals("PM") & !split2[2].Equals("12")) { endHour = Int32.Parse(split2[0]) + 12; } else if (split2[2].Equals("AM") && split2[2].Equals("12")) { endHour = 24; } else { endHour = Int32.Parse(split2[0]); } model.StartMin = startMin; model.StartHour = startHour; model.EndMin = endMin; model.EndHour = endHour; model.Day = NewDate.Day; model.Month = NewDate.Month; model.Year = NewDate.Year; //uvModel.GetEventsCreatedBy((int)Session["UserId"]); model.ChangeEventDetails(model); model2.GetEventsCreatedBy((int)Session["UserId"]); return View("ModifyEvents", model2); }