Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("AccountId,ContactId")] AccountContacts accountContacts)
        {
            if (id != accountContacts.AccountId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(accountContacts);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AccountContactsExists(accountContacts.AccountId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AccountId"] = new SelectList(_context.Accounts, "Id", "Name", accountContacts.AccountId);
            ViewData["ContactId"] = new SelectList(_context.Contacts, "Id", "Name", accountContacts.ContactId);
            return(View(accountContacts));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Weight,Name")] TicketImpacts ticketImpacts)
        {
            if (id != ticketImpacts.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(ticketImpacts);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TicketImpactsExists(ticketImpacts.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(ticketImpacts));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,ContractId,AssignedTo,Description,DateFrom,ContactId,TicketTypeId,EstimatedHours,CreatedBy,TicketImpactId,TicketUrgencyId,TicketPriority,Status")] Tickets tickets)
        {
            if (id != tickets.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tickets);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TicketsExists(tickets.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ContactId"]       = new SelectList(_context.Contacts, "Id", "Email", tickets.ContactId);
            ViewData["ContractId"]      = new SelectList(_context.Contracts, "Id", "Name", tickets.ContractId);
            ViewData["TicketImpactId"]  = new SelectList(_context.TicketImpacts, "Id", "Name", tickets.TicketImpactId);
            ViewData["TicketTypeId"]    = new SelectList(_context.TicketTypes, "Id", "Name", tickets.TicketTypeId);
            ViewData["TicketUrgencyId"] = new SelectList(_context.TicketUrgencies, "Id", "Name", tickets.TicketUrgencyId);
            ViewData["AssignedTo"]      = new SelectList(_userContext.Users.ToList(), "Id", "UserName", tickets.AssignedTo);
            ViewData["CreatedBy"]       = new SelectList(_userContext.Users.ToList(), "Id", "UserName", tickets.CreatedBy);
            return(View(tickets));
        }