Beispiel #1
0
        public async Task <IActionResult> KisiGuncelle(int id, Kisi kisi)
        {
            if (id != kisi.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public T Update(T entity)
        {
            entity.GetType().GetProperty("GuncellenmeTarihi").SetValue(entity, DateTime.Now);
            _context.Set <T>().Attach(entity);
            _context.Entry <T>(entity).State = EntityState.Modified;

            return(entity);
        }