Пример #1
0
        public async Task <IActionResult> Create([Bind("Id,Nome,Sobrenome,CPF,CEP,Numero,Complemento,Telefone,Celular,Email_primario,Email_secundario")] Cliente cliente)
        {
            if (ModelState.IsValid)
            {
                _context.Add(cliente);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(cliente));
        }
Пример #2
0
        public async Task <IActionResult> Create([Bind("Id,Username,Senha,Email,Email_suporte,Cel,Hierarquia")] Login login)
        {
            if (ModelState.IsValid)
            {
                _context.Add(login);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(login));
        }
Пример #3
0
        public async Task <IActionResult> Create([Bind("Id,Nome,Raca")] Pet pet)
        {
            if (ModelState.IsValid)
            {
                _context.Add(pet);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(pet));
        }
Пример #4
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            Usuario usuario = await db.Usuario.FindAsync(id);

            db.Usuario.Remove(usuario);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Пример #5
0
        static async void StartNew(string ID)
        {
            try
            {
                // Check if the Operation exsit before
                if (ModelDB.Data.Where(s => s.PostID.ToString() == ID).Count() == 0)
                {
                    try
                    {
                        //Create New Operation
                        ModelDB.Data.Add(new OperationData()
                        {
                            PostID = ID
                        });
                        await ModelDB.SaveChangesAsync();

                        try
                        {
                            //Fire Thread for Gether Likes
                            new Thread(() =>
                            {
                                dynamic likes = _operation.Get(ID + "/likes?limit=100");
                                FillLikesModel(ID, likes);
                            }).Start();
                        }
                        catch { }
                        try
                        {
                            //Fire Thread for Gether Comments
                            new Thread(() =>
                            {
                                dynamic comments = _operation.Get(ID + "/comments?limit=100");
                                FillCommentsModel(ID, comments);
                            }).Start();
                        }
                        catch { }
                    }
                    catch
                    {
                    }
                }
                else
                {
                    Console.WriteLine("I fount this Operation started \n close[N]?");
                    Console.Write("Your Choice: ");
                    bool control = true;

                    while (control)
                    {
                        try
                        {
                            switch (Console.ReadLine())
                            {
                            case "N":
                            case "n":
                                control = false;
                                break;

                            default:
                                Console.WriteLine("Wrong Choice.");
                                Console.Beep();
                                Console.Write("Your Choice: ");
                                break;
                            }
                        }
                        catch
                        {
                        }
                    }
                }
            }
            catch { }
        }