コード例 #1
0
        public async Task <IActionResult> Create([Bind("Id,Name,RegistrationDate,Status")] Client client)
        {
            if (ModelState.IsValid)
            {
                _context.Add(client);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(client));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("Id,Term,IsTrending,Status")] TermToSearch termToSearch)
        {
            if (ModelState.IsValid)
            {
                _context.Add(termToSearch);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(termToSearch));
        }
コード例 #3
0
        public async Task <IActionResult> Create([Bind("Id,Name,IdPublisherIndicator,Status")] Publisher publisher)
        {
            if (ModelState.IsValid)
            {
                _context.Add(publisher);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdPublisherIndicator"] = new SelectList(_context.PublisherIndicator, "Id", "Id", publisher.IdPublisherIndicator);
            return(View(publisher));
        }
コード例 #4
0
        public async Task <IActionResult> Create([Bind("Id,IdClient,Name,Status,TimeVideo")] Group @group)
        {
            if (ModelState.IsValid)
            {
                _context.Add(@group);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdClient"] = new SelectList(_context.Client, "Id", "Name", @group.IdClient);
            return(View(@group));
        }
コード例 #5
0
        public async Task <IActionResult> Create([Bind("IdUser,IdNews")] ImportantNews importantNews)
        {
            if (ModelState.IsValid)
            {
                _context.Add(importantNews);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdNews"] = new SelectList(_context.News, "Id", "Id", importantNews.IdNews);
            //ViewData["IdUser"] = new SelectList(_context.User, "Id", "Email", importantNews.IdUser);
            return(View(importantNews));
        }
コード例 #6
0
        public async Task <IActionResult> Create([Bind("Id,IdGroup,IdRole,User1,Password,Name,LastName,MLastName,Email,Phone,Status,LnToken,DateUpdate,DateCreate")] User user)
        {
            if (ModelState.IsValid)
            {
                _context.Add(user);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdGroup"] = new SelectList(_context.Group, "Id", "Name", user.IdGroup);
            ViewData["IdRole"]  = new SelectList(_context.Role, "Id", "Name", user.IdRole);
            return(View(user));
        }
コード例 #7
0
        public async Task <IActionResult> Create([Bind("Id,IdCategory,DatePublished,Name,Url,Description,Text,Status,IdOpinion,IdClassification,IsHeadline")] News news)
        {
            if (ModelState.IsValid)
            {
                _context.Add(news);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdCategory"]       = new SelectList(_context.Category, "Id", "Name", news.IdCategory);
            ViewData["IdClassification"] = new SelectList(_context.Classification, "Id", "Name", news.IdClassification);
            ViewData["IdOpinion"]        = new SelectList(_context.Opinion, "Id", "Id", news.IdOpinion);
            return(View(news));
        }