return view with empty model

3

I do the submit to save, and I want it to return in the same view, but with the empty fields, a new model, so it can be added again

But he always comes back with the data I filled out

My action looks like this:

public ActionResult SalvarNovo(grupoViewModel model)
{
  if (ModelState.IsValid)
  {
    Grupo entity = new Grupo();
    Mapper.Map(model, entity);

    grupocService.Adiciona(entity);
  }
  return View("Novo");
}

How do I return the fields empty? or direct to that view again?

    
asked by anonymous 22.08.2014 / 14:30

2 answers

3

Assuming this SalvarNovo is the action of submit of form you simply redirect the user to the action that generates the view of the form.

return RedirectToAction("nome da action que gera o formulario");
    
22.08.2014 / 14:39
2

Use RedirectToAction :

return RedirectToAction("Novo");
    
22.08.2014 / 14:40