Beispiel #1
0
        public async void UnassingCommonChef(int commonId, int chefId)
        {
            CommonChef commonChef = await _context.CommonChefs.FindAsync(commonId, chefId);

            if (commonChef != null)
            {
                Remove(commonChef);
            }
        }
Beispiel #2
0
        public async Task AssignCommonChef(int commonId, int chefId)
        {
            CommonChef commonChef = await _context.CommonChefs.FindAsync(commonId, chefId);

            if (commonChef != null)
            {
                await AddAsync(commonChef);
            }
        }
Beispiel #3
0
        public async Task <CommonChefResponse> UnassingCommonChefAsync(int userChefId, int userCommonId)
        {
            try
            {
                CommonChef commonChef = await _commonChefRepository.FindByCommonIdAndChefId(userChefId, userCommonId);

                _commonChefRepository.Remove(commonChef);
                await _unitOfWork.CompleteAsync();

                return(new CommonChefResponse(commonChef));
            }
            catch (Exception ex)
            {
                return(new CommonChefResponse($"An error ocurred while assigning Tag to CommonChef: {ex.Message}"));
            }
        }
Beispiel #4
0
 public void Remove(CommonChef commonChef)
 {
     _context.CommonChefs.Remove(commonChef);
 }
Beispiel #5
0
 public async Task AddAsync(CommonChef commonChef)
 {
     await _context.CommonChefs.AddAsync(commonChef);
 }