Id not accepting value asp mvc 5

0

Personally I'm trying to do a login logic but in a way without using the other asp mvc 5 technologies

[HttpPost]


[ValidateAntiForgeryToken]

public ActionResult Cadastro(Fornecedor fornecedo, int? id )

{

    var acesso = db.Fornecedor.Any(m => m.Codigo == id);

    if (acesso == false)

    {

        db.Fornecedor.Add(fornecedo);

        db.SaveChanges();

        return RedirectToAction("a");



    }

    if(acesso == true){
                ViewData["erro"] = "Mensagem de Erro";
                return View();
            }
            return View("z");
        }

When I register with the same code it gives an error that already exists this code but when I see if it has some data of the id for null.

    
asked by anonymous 05.06.2017 / 18:22

0 answers