public async Task <int> AddComputerDrive(ComputerDriveModel computerDriveModel, string email)
        {
            try
            {
                computerDriveModel.UserId = (await _context.Users.FirstOrDefaultAsync(user => user.Email == email)).Id;
                var computerDrive = new ComputerDrive(computerDriveModel);
                await AddGoodData(computerDriveModel.ImageIds, computerDrive);

                await _context.ComputerDrives.AddAsync(computerDrive);

                await _context.SaveChangesAsync();

                return(1);
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #2
0
 /// <summary>
 /// Handle the update of the text for the control from any source,
 /// including the TextBox part and the Text dependency property.
 /// </summary>
 /// <param name="newDirectory">The new directory.</param>
 private void DirectoryUpdated(ComputerDrive newDirectory)
 {
     // Update the interface and values only as necessary
     UpdateDirectoryValue();
 }