Exemple #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Vendedor")] Salesman salesman)
        {
            if (id != salesman.SalesmanId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(salesman);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SalesmanExists(salesman.SalesmanId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(salesman));
        }
Exemple #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Nome,Email,DataNascimento,Rg,Cpf,Celular,Telefone,NomeMae,Sexo,Cep,Logradouro,Numero,Complemento,Bairro,Cidade,Estado,QuantFuncionarios,TypeserviceId")] Partner partner)
        {
            if (id != partner.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(partner);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PartnerExists(partner.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TypeserviceId"] = new SelectList(_context.Typeservice, "Id", "Id", partner.TypeserviceId);
            return(View(partner));
        }
Exemple #3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Numbercard,Dateofbirth,Cpf,Andress,Service")] Solicitation solicitation)
        {
            if (id != solicitation.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(solicitation);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SolicitationExists(solicitation.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(solicitation));
        }
Exemple #4
0
        public async Task Update(Serviceprovider obj)
        {
            bool hasAny = await _context.Serviceprovider.AnyAsync(x => x.Id == obj.Id);

            if (!hasAny)
            {
                throw new NotFoundException("Id not found");
            }
            try
            {
                _context.Update(obj);
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException e)
            {
                throw new DbConcurrencyException(e.Message);
            }
        }