コード例 #1
0
ファイル: PeopleDAL.cs プロジェクト: jsed500/AireLogic
 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;
     }
 }
コード例 #2
0
        /// <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();
        }