Пример #1
0
        public ActionResult Commands()
        {
            List <CommandModel> commands = new List <CommandModel>();
            var         data             = _commandCollection.GetCommands();
            DtoStatus   dtoStatus        = _commandCollection.GetStatus();
            StatusModel statusObject     = new StatusModel()
            {
                Status = dtoStatus.Status
            };

            ViewBag.Status = statusObject.Status;

            foreach (var row in data)
            {
                commands.Add(new CommandModel
                {
                    Id          = row.Id,
                    Name        = row.Name,
                    Usage       = row.Usage,
                    Description = row.Description
                });
            }

            return(View(commands));
        }
Пример #2
0
        public DtoStatus GetStatus()
        {
            DtoStatus dtostatus = null;
            string    sql       = "SELECT `status` from kleuterbot";

            try
            {
                using (MySqlConnection conn = Sqlconnection())
                {
                    using (MySqlCommand command = new MySqlCommand(sql, conn))
                    {
                        using (MySqlDataReader reader = command.ExecuteReader())
                        {
                            if (reader.Read())
                            {
                                dtostatus = new DtoStatus()
                                {
                                    Status = reader.GetString(0)
                                };
                            }
                            return(dtostatus);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw new Exception(e.Message);
            }
        }
Пример #3
0
        public DtoStatus GetStatus()
        {
            DtoStatus status = _dalClass.GetStatus();

            return(status);
        }