private int Insert(CalendarEvent eventInsert) { db.Calendar.Add(eventInsert); db.SaveChanges(); return(eventInsert.id); }
public ActionResult Create(Calendar calendar) { db.Calendar.Add(calendar); db.SaveChanges(); var day = calendar.StartDate.Day; var month = calendar.StartDate.Month; var year = calendar.StartDate.Year; return(Redirect("/Calendar/Index?Year=" + year + "&Month=" + month + "&Day=" + day)); }