public Task <ActionResult> PayMethodEdit(ReturnPaymentProcessor data)
        {
            var result = _updateMethods.UpdatePaymentProcessor(new PaymentChanges
            {
                PkCode = data.PkCode
                ,
                NewStatus = data.Status
                ,
                NewProcessorName = data.Processor
                ,
                NewNameUI = data.NameUI
            }).Result;

            if (result)
            {
                return(Task.FromResult <ActionResult>(RedirectToAction("PayMethodList")));
            }

            ModelState.AddModelError(key: "", errorMessage: "Ha ocurrido un error.\n");
            return(Task.FromResult <ActionResult>(View()));
        }
Beispiel #2
0
        public Task <ReturnPaymentProcessor> ReturnPaymentProcessor(int pkPaymentProcessor)
        {
            try
            {
                ReturnPaymentProcessor paymentProcessor = new ReturnPaymentProcessor();
                using (var conn = _settings.GetConnection())
                {
                    if (conn.State == ConnectionState.Closed)
                    {
                        conn.Open();
                    }

                    string query = $"SELECT * FROM RETORNA_PROCESADOR({pkPaymentProcessor});";
                    using (var cmd = new SqlCommand(query, conn))
                    {
                        cmd.CommandType = CommandType.Text;
                        var dr = cmd.ExecuteReader();
                        while (dr.Read())
                        {
                            paymentProcessor.PkCode      = dr.GetInt32(0);
                            paymentProcessor.Code        = (dr.IsDBNull(1) ? null: dr.GetString(1));
                            paymentProcessor.Processor   = dr.GetString(2);
                            paymentProcessor.NameUI      = dr.GetString(3);
                            paymentProcessor.PaymentType = dr.GetInt32(4);
                            paymentProcessor.Status      = dr.GetBoolean(5);
                        }
                    }
                }
                return(Task.FromResult(paymentProcessor));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(null);
            }
        }