コード例 #1
0
        public async Task <IActionResult> PutInquilino(long id, Inquilino inquilino)
        {
            if (id != inquilino.InquilinoId)
            {
                return(BadRequest());
            }

            _context.Entry(inquilino).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!InquilinoExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
コード例 #2
0
        public async Task <IActionResult> PutAlquiler(long id, Alquiler alquiler)
        {
            if (id != alquiler.AlquilerId)
            {
                return(BadRequest());
            }

            _context.Entry(alquiler).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AlquilerExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
コード例 #3
0
        public async Task <IActionResult> PutPropietario(Propietario propietario)
        {
            if (ModelState.IsValid && propietario.Mail == User.Identity.Name)
            {
                string hashed = Convert.ToBase64String(KeyDerivation.Pbkdf2(
                                                           password: propietario.Password,
                                                           salt: System.Text.Encoding.ASCII.GetBytes(configuration["Salt"]),
                                                           prf: KeyDerivationPrf.HMACSHA1,
                                                           iterationCount: 1000,
                                                           numBytesRequested: 256 / 8
                                                           ));
                propietario.Password = hashed;

                _context.Entry(propietario).State = EntityState.Modified;

                try
                {
                    await _context.SaveChangesAsync();

                    return(Ok("Usuario Actualizado"));
                }
                catch (Exception ex)
                {
                    throw;
                }
            }



            return(BadRequest());
        }