public ActionResult Post([FromBody] RepartidoresModel repartidorm)
        {
            int    result = 0;
            string msj    = "¡Error al actualizar token intente más tarde!";

            try
            {
                if (repartidorm.NuevoToken())
                {
                    result = 1;
                    msj    = "¡Token actualizado!";
                }
            }
            catch
            {
                result = 0;
                msj    = "¡Error al actualizar token intente más tarde!";
            }

            return(Ok(new
            {
                resultado = result,
                mensaje = msj,
                repartidor = repartidorm
            }));
        }
        public ActionResult Post([FromBody] RepartidoresModel repartidorm)
        {
            int    result = 0;
            string msj    = "¡Error al obtener usuario intente más tarde!";

            try
            {
                RepartidoresModel aux = new RepartidoresModel();
                aux.PASSWORD = repartidorm.PASSWORD;
                if (repartidorm.obtenerUsuarioByTelefono())
                {
                    if (repartidorm.PASSWORD.Equals(aux.PASSWORD))
                    {
                        result = 1;
                        msj    = "¡Sesion iniciada!";
                    }
                    else
                    {
                        result = 0;
                        msj    = "¡Contraseña incorrecta!";
                    }
                }
                else
                {
                    result = 0;
                    msj    = "¡Usuario no existe!";
                }
            }
            catch
            {
                result = 0;
                msj    = "¡Error al obtener usuario intente más tarde!";
            }

            return(Ok(new
            {
                resultado = result,
                mensaje = msj,
                repartidor = repartidorm
            }));
        }
        public async Task <ActionResult> Post([FromBody] PedidosModel pedidom)
        {
            int    result = 0;
            string msj    = "¡Error al actualizar estatus intente más tarde!";

            try
            {
                if (pedidom.setEstatus())
                {
                    try
                    {
                        if (pedidom.obtenerPedidoByPk())
                        {
                            ClientesModel cliente = new ClientesModel();
                            cliente.PK = pedidom.PK_CLIENTE;
                            RepartidoresModel repartidor = new RepartidoresModel();
                            repartidor.PK = pedidom.PK_REPARTIDOR;
                            if (cliente.getClienteByPk() && repartidor.obtenerUsuarioByPK())
                            {
                                if (!string.IsNullOrEmpty(cliente.TOKEN))
                                {
                                    NotificacionesModel notificacion = new NotificacionesModel();
                                    switch (int.Parse(pedidom.PK_ESTATUS))
                                    {
                                    case 3:
                                        notificacion.TITLE   = "¡Tu repartidor esta en negocio!";
                                        notificacion.MESSAGE = "¡" + repartidor.NOMBRE + "' está esperando la entrega de tu pedido!";
                                        break;

                                    case 4:
                                        notificacion.TITLE   = "¡Tu pedido está en camino!";
                                        notificacion.MESSAGE = "¡" + repartidor.NOMBRE + "' está en camino con tu pedido!";
                                        break;

                                    case 5:
                                        notificacion.TITLE   = "¡Tu pedido se entrego!";
                                        notificacion.MESSAGE = "¡Gracias por utilizar acmarket!";
                                        break;
                                    }
                                    notificacion.TOKENS.Add(cliente.TOKEN);
                                    await notificacion.sendNotificationAsync();
                                }
                            }
                        }
                    }
                    catch (Exception e) { LogModel.registra("Error al enviar notificación set estatus Pedido Tienda", e.ToString()); }
                    result = 1;
                    msj    = "¡Estatus actualizado!";
                }
            }
            catch
            {
                result = 0;
                msj    = "¡Error al actualizar estatus intente más tarde!";
            }

            return(Ok(new
            {
                resultado = result,
                mensaje = msj,
                pedido = pedidom
            }));
        }