public ActionResult Create(Record record) { if (ModelState.IsValid) { record.Date = DateTime.Now; _recordRepo.CreateRecord(record); return(RedirectToAction("Index")); } return(View(record)); }
public IActionResult Submit(Record record) { Record newRecord = new Record { RecordId = record.RecordId, Nick = record.Nick, DatePosted = DateTime.Now, Country = record.Country, Email = record.Email, Comment = record.Comment }; if (ModelState.IsValid) { _recordRepository.CreateRecord(newRecord); return(RedirectToAction("Index", "Record")); } return(View("Index", record)); }