Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("JobTopicId,CollectionId,TopicName,SubscriptionName,TopicOrder,IsFirstStage,Enabled")] JobTopicSubscription jobTopicSubscription)
        {
            if (id != jobTopicSubscription.JobTopicId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(jobTopicSubscription);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!JobTopicSubscriptionExists(jobTopicSubscription.JobTopicId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }

                return(RedirectToAction(nameof(Index)));
            }

            ViewData["CollectionId"] = new SelectList(_context.Collection, "CollectionId", "Name", jobTopicSubscription.CollectionId);
            return(View(jobTopicSubscription));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("JobTopicId,CollectionId,TopicName,SubscriptionName,TopicOrder,IsFirstStage,Enabled")] JobTopicSubscription jobTopicSubscription)
        {
            if (ModelState.IsValid)
            {
                _context.Add(jobTopicSubscription);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }

            ViewData["CollectionId"] = new SelectList(_context.Collection, "CollectionId", "Name", jobTopicSubscription.CollectionId);
            return(View(jobTopicSubscription));
        }