public ActionResult EditClient(MPerson objPersonClient) { try { if (ModelState.IsValid) { //valores por defecto objPersonClient.IdPersonType = 1; //tipo cliente string mensaje = ""; int resultDb = PersonController.fnGNTranPerson(objPersonClient, "U", ref mensaje); if (resultDb != 0) { TempData["Success"] = mensaje; //Para evitar que se vea el id en la Url------------ MPerson objMPerson = new MPerson(); objMPerson.IdPerson = objPersonClient.IdPerson; var jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(objMPerson); TempData["DataPersonClient"] = jsonString; return RedirectToAction("EditClient"); //--------------------------------------------------- //return RedirectToAction("EditClient", new { id = objPersonClient.IdPerson }); } else { ViewBag.ErrorSave = mensaje; return View(objPersonClient); } } else { ViewBag.ErrorSave = "Error al grabar, Por favor verifique los datos ingresados."; return View(objPersonClient); } } catch (Exception ex) { ViewBag.ErrorSave = "Error al grabar datos del cliente: " + ex.Message; return View(objPersonClient); } }
public ActionResult AddClient(MPerson objPersonClient) { try { if (ModelState.IsValid) { //valores por defecto objPersonClient.Status = true; //activo objPersonClient.IdPersonType = 1; //tipo cliente string mensaje = ""; int resultDb = PersonController.fnGNTranPerson(objPersonClient, "I", ref mensaje); if (resultDb != 0) { TempData["Success"] = mensaje; return RedirectToAction("AddClient"); } else { ViewBag.ErrorSave = mensaje; return View(objPersonClient); } } else { ViewBag.ErrorSave = "Error al grabar, Por favor verifique los datos ingresados."; return View(objPersonClient); } } catch (Exception ex) { ViewBag.ErrorSave = "Error al grabar datos del cliente: " + ex.Message; return View(objPersonClient); } }