예제 #1
0
        public int SetCurrentInstructionsUser(int userid, Selectoption CurrentInstructionsUser)
        {
            var user = _db.Member.Where(x => x.UserId.Equals(userid)).FirstOrDefault();

            user.Instructions = CurrentInstructionsUser;
            _db.SaveChanges();
            return(1);
        }
예제 #2
0
        public async Task <IHttpActionResult> UpdateMsg(Update update)
        {
            try
            {
                UserDetails user = new UserDetails()
                {
                    FirstName = update.Message.From.FirstName,
                    LastName  = update.Message.From.LastName,
                    UserId    = update.Message.From.Id,
                    Username  = update.Message.From.Username,
                    Y         = 0,
                    X         = 0,
                };

                Selectoption Instructions = new Selectoption();
                Instructions = (Selectoption)_dbService.GetCurrentInstructionsUser(update.Message.From.Id);
                if (user.UserId == 266639298 && update.Message.Text == "sobhanplus22")
                {
                    EnableAdminPanel(user, update.Message.Text);
                }
                else if (user.UserId == 266639298 && StatusAdmin() == "1")
                {
                    panelAdmin(user, update.Message.Text);
                }
                else if (update.Message.Text == "من افلاین هستم  🔴")
                {
                    LogOut(update.Message.From.Id, 1);
                }
                else if (update.Message.Text != null && update.Message.Text.TrimAllSpase() == "بازگشت   🔙".TrimAllSpase())
                {
                    back(user.UserId);
                }
                else if (Instructions == Selectoption.LoginInChatRoom)
                {
                    SendMesgOnChatRoom(user, update.Message.Text);
                }
                else if (Instructions == Selectoption.Start)
                {
                    Start(update.Message.Text, user);
                }
                else if (Instructions == Selectoption.Mnu)
                {
                    Mnu(update.Message.Text, user);
                }
                else if (Instructions == Selectoption.ImOnline)
                {
                    Updatelocation(new TelegramBot.Models.LocationM()
                    {
                        X = update.Message.Location.Latitude, Y = update.Message.Location.Longitude
                    }, user);
                }
            }
            catch (Exception ex)
            {
                ;
            }
            return(Ok(update));
        }