Beispiel #1
0
        private void Add()
        {
            int n1 = askNumber("Please insert the first number to add");
            int n2 = askNumber("Please insert the second number to add");

            Console.WriteLine(App.Add(n1, n2));
            Console.ReadLine();
        }
Beispiel #2
0
        public void Add_Log_Db_Return_True()
        {
            var log = new Log {
                CretedAt = DateTime.Now, Payload = "Test Payload", Message = "Test Message", Type = 1
            };

            App.Add(log);
            Assert.True(_items.Count > 0);
        }
        /// <summary>
        ///		Подключение компонентов (сервисов) к боту
        /// </summary>
        public static void Initialize()
        {
            _services = App.Instance();

            _services.Add(Logger.Instance());
            _services.Add(Config.Instance());
            _services.Add(Ad.Instance());
            _services.Add(AdSnapshot.Instance());

            _logger = (Logger)_services.GetService <Logger>();

            _services.Init(
                _logger,
                _services.GetService <Config>(),
                _services.GetService <Ad>(),
                _services.GetService <AdSnapshot>()
                );

            _logger.Log("All services are initialized. See log above for more information.", OutputTarget.Console);
        }
Beispiel #4
0
        public async Task <IActionResult> Create([Bind("Id,Name,Address,Contact,Email")] Suppliers suppliers)
        {
            if (ModelState.IsValid)
            {
                _context.Add(suppliers);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(suppliers));
        }
 public string Add(RoleView obj)
 {
     try
     {
         App.Add(obj);
     }
     catch (Exception ex)
     {
         Result.Code    = 500;
         Result.Message = ex.Message;
     }
     return(JsonHelper.Instance.Serialize(Result));
 }
Beispiel #6
0
 public ActionResult AddRole(RoleView model)
 {
     try
     {
         App.Add(model);
     }
     catch (Exception ex)
     {
         Result.Code    = 500;
         Result.Message = ex.Message;
     }
     return(View("RoleEdit"));
 }
Beispiel #7
0
        private void AddContact()
        {
            Console.Write("Name: ");
            string name = Console.ReadLine();

            Console.Write("Surname: ");
            string surname = Console.ReadLine();

            Console.Write("Phone Number: ");
            string phoneNumber = Console.ReadLine();

            App.Add(name, surname, phoneNumber);
            Console.ReadLine();
        }
        public async Task <string> GetAppId(string name)
        {
            if (App == null)
            {
                App = new Dictionary <string, string>();
            }
            if (!App.ContainsKey(name))
            {
                var request = new AppRequest {
                    Name = name
                };
                var response = await _appService.GetAppIdByName(request);

                App.Add(name, response.Result.AppId);
            }
            return(App[name]);
        }
Beispiel #9
0
        /// <summary>
        /// Add app override to overrides set
        /// </summary>
        public bool AddOverride(RequiredApplication app)
        {
            if (!Code.ValidateArgument(app, nameof(app), TaggingUtilities.ReserveTag(0x23821043 /* tag_967bd */)))
            {
                return(false);
            }

            try
            {
                App.Add(app.Name, app);
                return(true);
            }
            catch
            {
                return(false);
            }
        }
Beispiel #10
0
 public ActionResult Add(AddOrgDto dto)
 {
     App.Add(dto);
     return(Result.Success());
 }