/// <summary> /// Добавляем пользователя, ожидаем JSON. API /// </summary> /// <param name="user"></param> /// <returns></returns> public async Task AddUserAsync(User user) { var userAdd = await context.Users.FindAsync(user.Id); if (userAdd == null) { context.Users.Add(user); await context.SaveChangesAsync(); } }
/// <summary> /// Добавить асинхронно нового пользователя /// </summary> /// <param name="aps"></param> /// <returns></returns> public async Task AddApartmentAsync(Apartments aps) { var apartmentAdd = await context.Apartments.FindAsync(aps.Id); if (apartmentAdd == null) { context.Add(aps); await context.SaveChangesAsync(); } }