public async void UnassingCommonChef(int commonId, int chefId) { CommonChef commonChef = await _context.CommonChefs.FindAsync(commonId, chefId); if (commonChef != null) { Remove(commonChef); } }
public async Task AssignCommonChef(int commonId, int chefId) { CommonChef commonChef = await _context.CommonChefs.FindAsync(commonId, chefId); if (commonChef != null) { await AddAsync(commonChef); } }
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}")); } }
public void Remove(CommonChef commonChef) { _context.CommonChefs.Remove(commonChef); }
public async Task AddAsync(CommonChef commonChef) { await _context.CommonChefs.AddAsync(commonChef); }