//POST: Editorial/Save public ActionResult save(WSEditorialOLD.WSEditorial editorial) { ActionResult resultado = null; if (ModelState.IsValid) { if (editorial.nombre != null) { try { using (WSEditorialOLD.WSEditorialOLD cliente = new WSEditorialOLD.WSEditorialOLD()) { cliente.Update(editorial); } //eS.update(editorial); ViewBag.Message = "La editorial se ha actualizado con exito"; } catch (Exception ex) { ViewBag.ErrorMessage = "Algo ha salido mal: " + ex.Message; } } else { //eS.create(editorial); using (WSEditorialOLD.WSEditorialOLD cliente = new WSEditorialOLD.WSEditorialOLD()) { cliente.Create(editorial); } ViewBag.Message = "La editorial se ha creado con exito"; } resultado = RedirectToAction("Index"); } else { resultado = View("Editorial", editorial); } return(resultado); }
public ActionResult createUpdate(int codEditorial = -1) { WSEditorialOLD.WSEditorial editorial = null; if (codEditorial < 0) { ViewBag.Title = "Editorial nuevo"; editorial = new WSEditorialOLD.WSEditorial(); using (WSEditorialOLD.WSEditorialOLD cliente = new WSEditorialOLD.WSEditorialOLD()) { editorial = cliente.Create(editorial); } } else { ViewBag.Title = "Editar editorial"; //editorial = eS.getById(codEditorial); using (WSEditorialOLD.WSEditorialOLD cliente = new WSEditorialOLD.WSEditorialOLD()) { editorial = cliente.Update(editorial); } } return(View("Editorial", editorial)); }