public async Task <ActionResult> OrderActionNew(int id, int status)
        {
            var order = await _orderService.FindAsync(id);

            order.Status   = status;
            order.Modified = DateTime.Now;
            _orderService.Update(order);

            await _unitOfWorkAsync.SaveChangesAsync();

            var pasajero    = _aspNetUserService.Query(x => x.Id == order.UserReceiver).Select().FirstOrDefault();
            var propietario = _aspNetUserService.Query(x => x.Id == order.UserProvider).Select().FirstOrDefault();
            var propiedad   = await _listingService.FindAsync(order.ListingID);

            var camas = _detailBedService.Query(x => x.ListingID == order.ListingID)
                        .Include(x => x.TypeOfBed).Select().ToList();

            string htmlcamas = "<br><table>";

            htmlcamas += "<tr><th>Cantidad</th><th>Plaza</th><tr>";
            foreach (var cama in camas)
            {
                htmlcamas += "<tr>";
                htmlcamas += " <th>" + cama.Quantity + "</th>";
                htmlcamas += " <th>" + cama.TypeOfBed.Name + "</th>";
                htmlcamas += "</tr>";
            }
            htmlcamas = htmlcamas + " </table> <br>";

            if (status == 4)
            {
                //Email a Pasajero
                var finishorderquery = await _emailTemplateService.Query(x => x.Slug.ToLower() == "finishorder").SelectAsync();

                var     templatefinishorder = finishorderquery.Single();
                dynamic emailordenpagada    = new Postal.Email("Email");
                emailordenpagada.To      = pasajero.Email;
                emailordenpagada.From    = CacheHelper.Settings.EmailAddress;
                emailordenpagada.Subject = templatefinishorder.Subject;
                emailordenpagada.Body    = templatefinishorder.Body;
                emailordenpagada.Name    = pasajero.FullName;
                emailordenpagada.OT      = order.OT;
                emailordenpagada.Camas   = htmlcamas;
                EmailHelper.SendEmail(emailordenpagada);

                //Email y telefono a Propietario
                var emailorderquery = await _emailTemplateService.Query(x => x.Slug.ToLower() == "payorder").SelectAsync();

                var templateorder = emailorderquery.Single();

                var servicio = order.Price * 0.04;

                dynamic emailorderpropietario = new Postal.Email("Email");
                emailorderpropietario.To       = propietario.Email;
                emailorderpropietario.From     = CacheHelper.Settings.EmailAddress;
                emailorderpropietario.Subject  = templateorder.Subject;
                emailorderpropietario.Body     = templateorder.Body;
                emailorderpropietario.FromDate = order.FromDate.Value.ToShortDateString();
                emailorderpropietario.ToDate   = order.ToDate.Value.ToShortDateString();
                emailorderpropietario.Id       = order.ListingID;
                emailorderpropietario.Tarifa   = propiedad.Price;
                emailorderpropietario.Total    = order.Price;
                emailorderpropietario.OT       = order.OT;
                emailorderpropietario.Abono    = order.Percent;
                EmailHelper.SendEmail(emailorderpropietario);

                //if (propietario.PhoneNumberConfirmed)
                SMSHelper.SendSMS(propietario.PhoneNumber, string.Format("La reserva ha sido confirmada exitosamente. La OT Asociada es la numero {0} Mayores detalles en su correo.", order.OT));
            }

            var result = new
            {
                Success = true,
                Message = "Hola"
            };

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        //[HttpPost]
        //[AllowAnonymous]
        //public async Task<ActionResult> ConfirmarPago(Order order)
        //{
        //    var listing = await _listingService.FindAsync(order.ListingID);
        //    var ordersListing = await _orderService.Query(x => x.ListingID == order.ListingID).SelectAsync();
        //    var userCurrent = User.Identity.User();

        //    order.OrderType = 3;


        //    _orderService.Insert(order);

        //    await _unitOfWorkAsync.SaveChangesAsync();

        //    ClearCache();

        //    ClearCache();
        //    TempData[TempDataKeys.UserMessage] = "[[[You booked your stay correctly!]]]";
        //    return RedirectToAction("Listing", "Listing", new { id = listing.ID });

        //}

        public async Task <ActionResult> EnviarCorreo(ConfirmOrder model, string correoPropietario)
        {
            var user = await UserManager.FindByNameAsync(model.Email);

            //Aqui enviamos el correo al pasajero
            #region Correo Pasajero
            var administrator      = _aspNetUserService.Query(x => x.AspNetRoles.Any(y => y.Name.Equals("Administrator"))).Select().FirstOrDefault();
            var emailTemplateQuery = await _emailTemplateService.Query(x => x.Slug.ToLower() == "confirmorder").SelectAsync();

            var emailTemplate = emailTemplateQuery.Single();

            if (emailTemplate != null)
            {
                dynamic email = new Postal.Email("Email");
                email.To               = user.Email;
                email.From             = CacheHelper.Settings.EmailAddress;
                email.Subject          = emailTemplate.Subject;
                email.Body             = emailTemplate.Body;
                email.Id               = model.Id;
                email.Name             = model.Name;
                email.FromDate         = model.FromDate;
                email.ToDate           = model.ToDate;
                email.Adults           = model.Adults;
                email.Children         = model.Children;
                email.Rent             = model.Rent;
                email.Service          = model.Service;
                email.CleanlinessPrice = model.CleanlinessPrice;
                email.Total            = model.Rent + model.CleanlinessPrice + model.Service;
                email.ShortDescription = model.ShortDescription;
                email.Description      = model.Description;
                email.Condominium      = model.Condominium;
                email.TypeOfProperty   = model.TypeOfProperty;
                email.Capacity         = model.Capacity;
                email.Rooms            = model.Rooms;
                email.Beds             = model.Beds;
                email.SuiteRooms       = model.SuiteRooms;
                email.Bathrooms        = model.Bathrooms;
                email.Dishwasher       = model.Dishwasher;
                email.Washer           = model.Washer;
                email.Grill            = model.Grill;
                email.TvCable          = model.TvCable;
                email.Wifi             = model.Wifi;
                email.Elevator         = model.Elevator;
                email.FloorNumber      = model.FloorNumber;
                email.Stay             = model.Stay;
                email.ConditionHouse   = model.ConditionHouse;
                EmailHelper.SendEmail(email);
            }
            #endregion

            //Con esto se envia el correo a la administracion y a PM
            #region Correo PM y Admin
            var emailorderquery = await _emailTemplateService.Query(x => x.Slug.ToLower() == "blockedproperty").SelectAsync();

            var templateorder = emailorderquery.Single();
            var admin         = await _aspNetUserService.Query(x => x.AspNetRoles.Any(z => z.Name == "Administrator")).SelectAsync();

            dynamic emailorder = new Postal.Email("Email");
            foreach (var administradores in admin)
            {
                emailorder.To       = administradores.Email;
                emailorder.From     = CacheHelper.Settings.EmailAddress;
                emailorder.Subject  = templateorder.Subject;
                emailorder.Body     = templateorder.Body;
                emailorder.Name     = administradores.FullName;
                emailorder.FromDate = model.FromDate;
                emailorder.ToDate   = model.ToDate;
                emailorder.Id       = model.Id;
                EmailHelper.SendEmail(emailorder);
            }
            #endregion

            //Aqui enviamos el correo y sms al propietario
            #region Correo Propietario
            var emailOwnerQuery = await _emailTemplateService.Query(x => x.Slug.ToLower() == "emailowner").SelectAsync();

            var emailOwner  = emailOwnerQuery.Single();
            var propietario = _aspNetUserService.Query(x => x.Email.Equals(correoPropietario)).Select().FirstOrDefault();
            var order       = _orderService.Query(x => x.ID == model.OrderId).Select().FirstOrDefault();
            var propiedad   = await _listingService.FindAsync(order.ListingID);

            dynamic ownermail = new Postal.Email("Email");
            ownermail.To         = propietario.Email;
            ownermail.From       = CacheHelper.Settings.EmailAddress;
            ownermail.Subject    = emailOwner.Subject;
            ownermail.Body       = emailOwner.Body;
            ownermail.Name       = propietario.FullName;
            ownermail.FromDate   = model.FromDate;
            ownermail.ToDate     = model.ToDate;
            ownermail.Tarifa     = propiedad.Price;
            ownermail.Total      = order.Price;
            ownermail.Passengers = order.Adults + order.Children;
            ownermail.Id         = model.Id;
            EmailHelper.SendEmail(ownermail);
            //if(prop.PhoneNumberConfirmed)
            SMSHelper.SendSMS(propietario.PhoneNumber, string.Format("Estimado {0} hemos recibido una reserva por su propiedad desde {1} hasta {2} Mayores detalles en su correo", propietario.FullName, model.FromDate, model.ToDate));
            #endregion
            return(RedirectToAction("Payment", "Payment", new { id = model.Id }));
        }