public ActionResult Create() { string email = User.Identity.Name; Person p = _personRepository.Get(x => x.email == email).First(); PersonGoal pg = new PersonGoal(); pg.personid = p.id; pg.dateStarted = DateTime.Now; pg.dateAchieved = DateTime.Now; ViewBag.Person = p; return View(pg); }
public ActionResult Create(PersonGoal pg,int personid) { string email = User.Identity.Name; Person p = _personRepository.Get(x => x.email == email).First(); try { pg.createdAt = DateTime.Now; pg.updatedAt = DateTime.Now; _persongoalRepository.Merge(pg); } catch (Exception ex) { } return RedirectToAction("Index"); }