public async Task <IActionResult> Edit(Guid id, [Bind("Id,Nome,Sexo,Nascimento,Cpf,Email,Celular,Endereco,Numero,CEP,Bairro,Cidade,Uf")] Cliente cliente)
        {
            if (id != cliente.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(cliente);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ClienteExists(cliente.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(cliente));
        }
Exemple #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,RoomName,RoomShortCode")] LocationRoom locationRoom)
        {
            if (id != locationRoom.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(locationRoom);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LocationRoomExists(locationRoom.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(locationRoom));
        }
Exemple #3
0
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,ImovelId,ClienteId,DataInicio,DataFim,Valor")] Contrato contrato)
        {
            if (id != contrato.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(contrato);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ContratoExists(contrato.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ClienteId"] = new SelectList(_context.Cliente, "Id", "Nome", contrato.ClienteId);
            ViewData["ImovelId"]  = new SelectList(_context.Imovel, "Id", "Nome", contrato.ImovelId);
            return(View(contrato));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,AddressLine1,AddressLine2,City,State,PostalCode,AddressShortCode")] LocationAddress locationAddress)
        {
            if (id != locationAddress.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(locationAddress);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LocationAddressExists(locationAddress.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(locationAddress));
        }
Exemple #5
0
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,TipoImovel")] Tipo tipo)
        {
            if (id != tipo.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tipo);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TipoExists(tipo.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(tipo));
        }
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,ImovelId,Caminho")] Foto foto)
        {
            if (id != foto.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(foto);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!FotoExists(foto.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ImovelId"] = new SelectList(_context.Imovel, "Id", "Bairro", foto.ImovelId);
            return(View(foto));
        }
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,Nome,TipoId,QUartos,Banheiros,Vagas,Area,Endereco,Numero,CEP,Bairro,Cidade,Uf")] Imovel imovel)
        {
            if (id != imovel.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(imovel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ImovelExists(imovel.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }

                if (HttpContext.Request.Form.Files != null)
                {
                    var files = HttpContext.Request.Form.Files;

                    await AddFoto(imovel, files, _context);
                }


                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TipoId"] = new SelectList(_context.Tipo, "Id", "TipoImovel", imovel.TipoId);
            return(View(imovel));
        }
 public async Task <IActionResult> Edit(LocationImageViewModel vm)
 {
     if (ModelState.IsValid)
     {
         try
         {
             _locationContext.Update(vm);
             await _locationContext.SaveChangesAsync();
         }
         catch (DbUpdateConcurrencyException)
         {
             if (!LocationExists(vm.LocationId))
             {
                 return(NotFound());
             }
             else
             {
                 throw;
             }
         }
         return(RedirectToAction("Details", "Courses", new { id = vm.CourseId }));
     }
     return(View(vm));
 }
Exemple #9
0
 public Task <int> UpdateParkrun(Parkrun parkrun)
 {
     _dbContext.Update(parkrun);
     return(_dbContext.SaveChangesAsync());
 }