public ActionResult Create([FromBody] WriterCreateModel writer) { _writerRepository.Add(new Writer { FirstName = writer.FirstName, LastName = writer.LastName, DateOfBirth = writer.DateOfBirth, Biography = writer.Biography }); return(Ok(writer)); }
public async Task <IActionResult> Create([Bind("FirstName,LastName,DateOfBirth,Biography")] WriterCreateModel writer) { if (ModelState.IsValid) { _writerRepository.Add(new Writer { FirstName = writer.FirstName, LastName = writer.LastName, DateOfBirth = writer.DateOfBirth, Biography = writer.Biography }); return(RedirectToAction("Index")); } return(View(writer)); }