public ActionResult Edit([Bind(Include = "END_ID,USU_ID,END_LOGRADOURO,END_NR,END_CIDADE,END_BAIRRO,END_CEP")] EnderecoModel eNDERECO) { string addrres = eNDERECO.END_LOGRADOURO + ", " + eNDERECO.END_NR + ", " + eNDERECO.END_CIDADE + ", " + eNDERECO.END_BAIRRO; var destination_latLong = GoogleGeoCorder.GetLatLongByAddress(addrres); //string lat = Convert.ToString(destination_latLong.results[0].geometry.location.lat, CultureInfo.InvariantCulture); //string lng = Convert.ToString(destination_latLong.results[0].geometry.location.lng, CultureInfo.InvariantCulture); eNDERECO.END_LATITUDE = "-1.29267215"; eNDERECO.END_LONGITUDE = "-48.47828597"; if (ModelState.IsValid) { try { enderecoDominio.alterar(eNDERECO); return(RedirectToAction("Principal", "Home", new { usu_id = eNDERECO.USU_ID })); } catch (Exception e) { mensagem = MensagemTela.erro("erro no sistema: " + e); return(View()); } } else { return(View(eNDERECO)); } }
public ActionResult Index(FormCollection campos) { ViewBag.text = ""; try { var usu_lg = campos["USU_LG"]; var buscalogin = usuarioDominio.buscaPorLogin(usu_lg); if (buscalogin.Count() > 0) { string usu_sn = null; int usu_id = 0; foreach (var item in buscalogin) { usu_sn = item.USU_SN; usu_lg = item.USU_LG; usu_id = item.USU_ID; } if (usu_sn == campos["USU_SN"].ToMD5()) { FormsAuthentication.RedirectFromLoginPage(usu_lg, false); return(RedirectToAction("Principal", new { usu_id = usu_id })); } else { mensagem = MensagemTela.erro("senha incorreta"); return(View()); } } else { mensagem = MensagemTela.erro("Login incorreto"); return(View()); } } catch (Exception ex) { mensagem = MensagemTela.erro(ex.Message); return(View()); } }
public ActionResult Create([Bind(Include = "USU_ID,END_NR,END_BAIRRO,END_CEP,END_LOGRADOURO,END_CIDADE")] EnderecoModel eNDERECO) { eNDERECO.USU_ID = usuarioLogado.USU_ID; string addrres = eNDERECO.END_LOGRADOURO + ", " + eNDERECO.END_NR + ", " + eNDERECO.END_CIDADE + ", " + eNDERECO.END_BAIRRO; var destination_latLong = GoogleGeoCorder.GetLatLongByAddress(addrres); //string lat = Convert.ToString(destination_latLong.results[0].geometry.location.lat, CultureInfo.InvariantCulture); //string lng = Convert.ToString(destination_latLong.results[0].geometry.location.lng, CultureInfo.InvariantCulture); eNDERECO.END_LATITUDE = "0"; eNDERECO.END_LONGITUDE = "0"; if (ModelState.IsValid) { try { enderecoDominio.inserir(eNDERECO); var buscalogin = usuarioDominio.buscaPorId(usuarioLogado.USU_ID); foreach (var item in buscalogin) { eNDERECO.USU_ID = item.USU_ID; } return(RedirectToAction("Principal", "Home", new { usu_id = eNDERECO.USU_ID })); } catch (Exception e) { mensagem = MensagemTela.erro("erro no sistema: " + e); return(View()); } } return(View(eNDERECO)); }