public IActionResult Add([FromForm] StudentModel model) { if (!ModelState.IsValid || !model.Create()) { return(View(model)); } return(RedirectToAction("ViewAll")); }
public IActionResult Create([FromBody] StudentModel model) { if (ModelState.IsValid && model.Create()) { return(Ok()); } else { return(BadRequest()); } }
public void Add(StudentModel model) { var entity = model.Create(model); _repo.Add <Student>(entity); }
public IActionResult Create(StudentModel studentModel) { studentModel.Create(); return(View(studentModel)); }