public ActionResult Create(Examen3_Progra4.Models.todoEstructure model,string statusList) { string valStatus = (statusList.Equals("Outgoing") ? "O" : statusList.Equals("Cancel") ? "C" : "D"); todo myTodo = new todo { nombre=model.nameTodo, descripcion=model.descriptionTodo, fechaI=model.dateI, fechaF=model.dateF, status=valStatus, userOwner=this.User.Identity.Name, }; try { db.todos.AddObject(myTodo); db.SaveChanges(); } catch { ModelState.AddModelError("", "It can't create the new TO-DO"); return View(model); } return RedirectToAction("MyToDo", "Todo"); // If we got this far, something failed, redisplay form }
public ActionResult Create(Examen3_Progra4.Models.meetingStructure model, FormCollection form) { meeting myMeet = new meeting { nombre = model.meetName, descripcion = model.meetDescription, fecha= model.meetDate, longitud=model.meetLength, latitud=model.meetLatitude, userOwner = this.User.Identity.Name, }; try { db.meetings.AddObject(myMeet); db.SaveChanges(); } catch { ModelState.AddModelError("", "It can't create the new Meeting"); return View(model); } return RedirectToAction("MyMeetings"); }
public ActionResult Edit(Examen3_Progra4.Models.meetingStructure meet) { meeting myMeet = db.meetings.Single(u => u.idMeet == meet.meetId); myMeet.nombre = meet.meetName; myMeet.descripcion = meet.meetDescription; myMeet.fecha = meet.meetDate; myMeet.longitud = meet.meetLength; myMeet.latitud = meet.meetLatitude; try { db.SaveChanges(); } catch { ModelState.AddModelError("", "It can't edit this Meeting"); return View(meet); } return RedirectToAction("MyMeetings"); }