コード例 #1
0
        public ActionResult Edit([Bind(Include = "devd_Id,dev_Id,prod_Id,prod_Precio,devd_Cantidad,devd_Impuesto,devd_Descuento,devd_UsuarioCrea,devd_FechaCrea,devd_UsuarioModifica,devd_FechaModifica")] tbDevolucionDetalle tbDevolucionDetalle)
        {
            //tbDevolucionDetalle.devd_UsuarioCrea = 3;
            //tbDevolucionDetalle.devd_FechaCrea = DateTime.Now;
            tbDevolucionDetalle.devd_UsuarioModifica = 3;
            tbDevolucionDetalle.devd_FechaModifica   = DateTime.Now;
            IEnumerable <object> listDevolucionDet = null;
            string MensajeError = "";

            if (ModelState.IsValid)
            {
                try
                {
                    listDevolucionDet = db.UDP_Vent_tbDevolucionDetalle_Update(tbDevolucionDetalle.devd_Id,
                                                                               tbDevolucionDetalle.dev_Id,
                                                                               tbDevolucionDetalle.prod_Id,
                                                                               tbDevolucionDetalle.prod_Precio,
                                                                               tbDevolucionDetalle.devd_Cantidad,
                                                                               tbDevolucionDetalle.devd_Impuesto,
                                                                               tbDevolucionDetalle.devd_Descuento,
                                                                               tbDevolucionDetalle.devd_UsuarioCrea,
                                                                               tbDevolucionDetalle.devd_FechaCrea,
                                                                               tbDevolucionDetalle.devd_UsuarioModifica,
                                                                               tbDevolucionDetalle.devd_FechaModifica);

                    foreach (UDP_Vent_tbDevolucionDetalle_Update_Result Resultado in listDevolucionDet)
                    {
                        MensajeError = Resultado.MensajeError;
                    }



                    if (MensajeError.StartsWith("-1"))
                    {
                        ModelState.AddModelError("", "No se pudo ingresar el registro, contacte al administrador");
                        return(View(tbDevolucionDetalle));
                    }
                }
                catch (Exception ex)
                {
                    ex.Message.ToString();
                }
                return(RedirectToAction("Index"));
            }
            ViewBag.devd_UsuarioCrea     = new SelectList(db.tbUsuarios, "usu_Id", "usu_NombreUsuario", tbDevolucionDetalle.devd_UsuarioCrea);
            ViewBag.devd_UsuarioModifica = new SelectList(db.tbUsuarios, "usu_Id", "usu_NombreUsuario", tbDevolucionDetalle.devd_UsuarioModifica);
            ViewBag.dev_Id = new SelectList(db.tbDevolucion, "dev_Id", "dev_Razon", tbDevolucionDetalle.dev_Id);
            return(View(tbDevolucionDetalle));
        }