Beispiel #1
0
        public IActionResult Add([FromForm] StudentModel model)
        {
            if (!ModelState.IsValid || !model.Create())
            {
                return(View(model));
            }

            return(RedirectToAction("ViewAll"));
        }
Beispiel #2
0
 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);
        }
Beispiel #4
0
 public IActionResult Create(StudentModel studentModel)
 {
     studentModel.Create();
     return(View(studentModel));
 }