public async Task UpdatePerson(People person) { try { _context.Entry(person).State = EntityState.Modified; _context.Entry(person).Collection(x => x.FavouriteColours).IsModified = false; _context.People.Update(person); await _context.SaveChangesAsync(); } catch (Exception ex) { throw ex; } }
/// <summary> /// To add new person to database /// </summary> /// <param name="entity">People entity</param> /// <returns>Rows inserted</returns> public async Task Create(People entity) { await _dbContext.Set <People>().AddAsync(entity); await _dbContext.SaveChangesAsync(); }