public ActionResult Create(ProformaWS.Proforma proforma) { try { ProformaWS.ProformaServiceClient proxy = new ProformaWS.ProformaServiceClient(); proxy.Agregar(proforma); ViewBag.message = "Creado"; return(View("Index", proxy.Listar().ToList())); } catch { return(View()); } }
// [TestMethod]//Crear public void CrearProforma() { try { int agregado; proforma.Cliente = "Roger Ramos"; proforma.Fecproforma = Convert.ToDateTime("01/10/2013"); proforma.Cantidad = 1; proforma.idmoneda = Convert.ToInt32(0); proforma.Subotal = Convert.ToDecimal(1500); proforma.Igv = Convert.ToDecimal(270); proforma.Total = Convert.ToDecimal(1770); proforma.Idunidadinmobiliaria = Convert.ToInt32(1); agregado = proxy.Agregar(proforma); Assert.AreEqual(agregado, 12); } catch (Exception ex) { Assert.AreEqual(ex.Message, "No se pudo insertar el registro en la base de datos."); } }