public async Task <IActionResult> Create([Bind("Id,Name,Endereco,Telefone,Email,CNPJ")] Models.Loja cliente) { if (ModelState.IsValid) { await _repositoryLoja.InsertAsync(cliente); return(RedirectToAction(nameof(Index))); } return(View(cliente)); }
public async Task <IActionResult> Edit(long id, [Bind("Id,Name,Endereco,Telefone,Email,CNPJ")] Models.Loja cliente) { if (id != cliente.Id) { return(NotFound()); } if (ModelState.IsValid) { await _repositoryLoja.UpdateAsync(id, cliente); return(RedirectToAction(nameof(Index))); } return(View(cliente)); }
public Models.Loja CarregaDadosSalvos() { string strquery = "Select * FROM loja order by MasterID desc"; DataTable dt = Dados.ExecutaSQLDataTable(strquery); Models.Loja loja = new Models.Loja(); if (dt.Rows.Count > 0) { loja.Email = dt.Rows[0]["Nome"].ToString(); loja.Senha = dt.Rows[0]["Senha"].ToString(); loja.MasterID = Convert.ToInt32(dt.Rows[0]["MasterID"]); } return(loja); }