// public ActionResult Create([Bind(Include = "LastName, FirstMidName, EnrollmentDate")] Student student) public ActionResult Create(CreateGoalModel model) { using (var db = new Capstone2020Context(nameof(Capstone2020Context))) { model.UserEventId = Guid.NewGuid().ToString(); model.RevisionID = 0; var @event = new UserEvent { UserEventId = model.UserEventId, UserId = User.Identity.GetUserId(), ColorID = 1, CompletedDate = model.CompletedDate, CreationDate = DateTime.Now, EventTitle = model.EventTitle, EventText = model.EventText, RecurID = 0, EventTypeId = 1 }; string CurrentUserId = User.Identity.GetUserId(); db.Set <UserEvent>().Add(@event); db.SaveChanges(); } return(RedirectToAction("Index")); }
public ActionResult Edit(int id, CreateGoalModel model) { if (ModelState.IsValid) { // TODO: Add update logic here using (var db = new Capstone2020Context(nameof(Capstone2020Context))) { model.RevisionID = model.RevisionID + 1; db.SaveChanges(); } return(RedirectToAction("Index")); } else { return(View(model)); } }