public static Response ChangeStateToAddStop(string clientId)
 {
     using (ClientDataContext db = new ClientDataContext())
     {
         var clientState = GetClientState(clientId);
         clientState.ClientStatus = Status.AddingStop;
         db.ClientStates.Update(clientState);
         db.SaveChanges();
         return(StateHelper.GetInstruction(clientState));
     }
 }
 public static Response AddBufferTag(string clientId, string tagName)
 {
     using (ClientDataContext db = new ClientDataContext())
     {
         var clientState = GetClientState(clientId);
         clientState.BufferTagName = tagName;
         clientState.ClientStatus  = Status.AddingRoute;
         db.ClientStates.Update(clientState);
         db.SaveChanges();
         return(StateHelper.GetInstruction(clientState));
     }
 }
 public static Response ContinueWorkOrChangeToDefaultState(string clientId, bool flag)
 {
     using (ClientDataContext db = new ClientDataContext())
     {
         var clientState = GetClientState(clientId);
         var response    = StateHelper.GetInstruction(clientState);
         if (!flag)
         {
             clientState.ClientStatus = Status.Default;
             response = new Response(@"Хорошо, как говорится, забудем ""старое""");
         }
         clientState.WaitingToContinue = false;
         db.ClientStates.Update(clientState);
         db.SaveChanges();
         return(response);
     }
 }
        public static Response FindRouteDirections(string clientId, string routeName)
        {
            var route = Parser.FindRouteNum(routeName);

            if (route == null)
            {
                return(new Response("Мне не удалось найти такой маршрут, проверьте правильность введенного номера маршрута"));
            }
            var directions = Parser.GetRouteChoice(route);

            using (ClientDataContext db = new ClientDataContext())
            {
                var clientState = GetClientState(clientId);
                clientState.ClientStatus     = Status.ChoosingDirection;
                clientState.BufferRouteName  = routeName;
                clientState.BufferDirections = directions;
                db.ClientStates.Update(clientState);
                db.SaveChanges();
                return(StateHelper.GetInstruction(clientState));
            }
        }