public async Task <IResponse <UserInRole> > Add(UserInRole model) { if (await _userInRoleRepo.AnyAsync(x => x.UserId == model.UserId && x.RoleId == model.RoleId)) { return new Response <UserInRole> { Message = ServiceMessage.DuplicateRecord, IsSuccessful = false } } ; await _userInRoleRepo.AddAsync(model); var saveResult = await _authUow.ElkSaveChangesAsync(); return(new Response <UserInRole> { Result = model, Message = saveResult.Message, IsSuccessful = saveResult.IsSuccessful }); }
public async Task <bool> CheckOwner(int storeId, Guid userId) => await _storeRepo.AnyAsync(x => x.StoreId == storeId && x.UserId == userId);
public async Task <bool> CheckOwner(Guid userId, int orderId) => await _orderRepo.AnyAsync(x => x.OrderId == orderId && x.Store.UserId == userId);